llvm-project/llvm/lib/Transforms
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
..
Coroutines Make internal/private GVs implicitly dso_local. 2018-01-11 22:15:05 +00:00
Hello Add auto-exporting of symbols from tools so that plugins work on Windows 2016-05-26 11:16:43 +00:00
IPO [NFC] fix trivial typos in comments 2018-01-19 10:55:29 +00:00
InstCombine Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
Instrumentation Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
ObjCARC [ObjCARC] Do not turn a call to @objc_autoreleaseReturnValue into a call 2018-01-19 23:51:13 +00:00
Scalar [NFC] fix trivial typos in comments 2018-01-19 10:55:29 +00:00
Utils [NFC] fix trivial typos in comments 2018-01-19 10:55:29 +00:00
Vectorize [SLP] Fix vectorization for tree with trunc to minimum required bit width. 2018-01-19 14:40:13 +00:00
CMakeLists.txt [coroutines] Part 3 of N: Adding Boilerplate for Coroutine Passes 2016-07-28 21:04:31 +00:00
LLVMBuild.txt [coroutines] Part 3 of N: Adding Boilerplate for Coroutine Passes 2016-07-28 21:04:31 +00:00