llvm-project/llvm/lib/Transforms/ObjCARC
Akira Hatanaka 73ceb50d85 [ObjCARC] Do not turn a call to @objc_autoreleaseReturnValue into a call
to @objc_autorelease if its operand is a PHI and the PHI has an
equivalent value that is used by a return instruction.

For example, ARC optimizer shouldn't replace the call in the following
example, as doing so breaks the AutoreleaseRV/RetainRV optimization:

  %v1 = bitcast i32* %v0 to i8*
  br label %bb3
bb2:
  %v3 = bitcast i32* %v2 to i8*
  br label %bb3
bb3:
  %p = phi i8* [ %v1, %bb1 ], [ %v3, %bb2 ]
  %retval = phi i32* [ %v0, %bb1 ], [ %v2, %bb2 ] ; equivalent to %p
  %v4 = tail call i8* @objc_autoreleaseReturnValue(i8* %p)
  ret i32* %retval

Also, make sure ObjCARCContract replaces @objc_autoreleaseReturnValue's
operand uses with its value so that the call gets tail-called.

rdar://problem/15894705

llvm-svn: 323009
2018-01-19 23:51:13 +00:00
..
ARCRuntimeEntryPoints.h [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-27 01:09:08 +00:00
BlotMapVector.h [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-27 01:09:08 +00:00
CMakeLists.txt [CMake] NFC. Updating CMake dependency specifications 2016-11-17 04:36:50 +00:00
DependencyAnalysis.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
DependencyAnalysis.h
LLVMBuild.txt
ObjCARC.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
ObjCARC.h [ObjCARC] Do not turn a call to @objc_autoreleaseReturnValue into a call 2018-01-19 23:51:13 +00:00
ObjCARCAPElim.cpp
ObjCARCContract.cpp [ObjCARC] Do not turn a call to @objc_autoreleaseReturnValue into a call 2018-01-19 23:51:13 +00:00
ObjCARCExpand.cpp
ObjCARCOpts.cpp [ObjCARC] Do not turn a call to @objc_autoreleaseReturnValue into a call 2018-01-19 23:51:13 +00:00
ProvenanceAnalysis.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-27 01:09:08 +00:00
ProvenanceAnalysis.h [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-27 01:09:08 +00:00
ProvenanceAnalysisEvaluator.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
PtrState.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-27 01:09:08 +00:00
PtrState.h [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-27 01:09:08 +00:00