Exploit this-return of a callsite in a this-return function.
authorManman Ren <mren@apple.com>
Wed, 20 Mar 2013 16:59:38 +0000 (16:59 +0000)
committerManman Ren <mren@apple.com>
Wed, 20 Mar 2013 16:59:38 +0000 (16:59 +0000)
commit0175461296044bd572559b9a4a5473ddcd411bce
tree53ebc887f08494e93b5f8d14fdfaa31c9c53b54a
parent7a8bb72a3a01d20bd899befc0b265117ef25b1f1
Exploit this-return of a callsite in a this-return function.

For constructors/desctructors that return 'this', if there exists a callsite
that returns 'this' and is immediately before the return instruction, make
sure we are using the return value from the callsite.

We don't need to keep 'this' alive through the callsite. It also enables
optimizations in the backend, such as tail call optimization.

Updated from r177211.
rdar://12818789

llvm-svn: 177541
clang/lib/CodeGen/CGCXXABI.h
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CGClass.cpp
clang/lib/CodeGen/CodeGenFunction.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/CodeGen/MicrosoftCXXABI.cpp
clang/test/CodeGenCXX/arm.cpp
clang/test/CodeGenCXX/constructor-destructor-return-this.cpp [new file with mode: 0644]