llvm-project/llvm/test/Transforms/ObjCARC
Akira Hatanaka 490397fc08 [ObjCARC] Do not sink an objc_retain past a clang.arc.use.
We need to do this to prevent a miscompile which sinks an objc_retain
past an objc_release that releases the object objc_retain retains. This
happens because the top-down and bottom-up traversals each determines
the insert point for retain or release individually without knowing
where the other instruction is moved.

For example, when the following IR is fed to the ARC optimizer, the
top-down traversal decides to insert objc_retain right before
objc_release and the bottom-up traversal decides to insert objc_release
right after clang.arc.use.

(IR before ARC optimizer)
%11 = call i8* @objc_retain(i8* %10)
call void (...) @clang.arc.use(%0* %5)
call void @llvm.dbg.value(...)
call void @objc_release(i8* %6)

This reverses the order of objc_release and objc_retain, which causes
the object to be destructed prematurely.

(IR after ARC optimizer)
call void (...) @clang.arc.use(%0* %5)
call void @objc_release(i8* %6)
call void @llvm.dbg.value(...)
%11 = call i8* @objc_retain(i8* %10)

rdar://problem/30530580

llvm-svn: 301289
2017-04-25 04:06:35 +00:00
..
allocas.ll
apelim.ll
basic.ll
cfg-hazards.ll
clang-arc-use-barrier.ll [ObjCARC] Do not sink an objc_retain past a clang.arc.use. 2017-04-25 04:06:35 +00:00
comdat-ipo.ll
contract-end-of-use-list.ll
contract-marker.ll
contract-replace-arg-use.ll
contract-storestrong-ivar.ll
contract-storestrong.ll [ObjCArc] Do not dereference an invalidated iterator. 2017-04-05 03:44:09 +00:00
contract-testcases.ll
contract.ll
empty-block.ll
ensure-that-exception-unwind-path-is-visited.ll
escape.ll
expand.ll
gvn.ll
intrinsic-use-isolated.ll
intrinsic-use.ll [ObjCARC] Do not sink an objc_retain past a clang.arc.use. 2017-04-25 04:06:35 +00:00
invoke.ll
move-and-form-retain-autorelease.ll
move-and-merge-autorelease.ll
nested.ll
path-overflow.ll
pointer-types.ll
post-inlining.ll
pr12270.ll
provenance.ll
retain-block-side-effects.ll
retain-not-declared.ll
rle-s2l.ll
rv.ll
split-backedge.ll
tail-call-invariant-enforcement.ll
unsafe-claim-rv.ll
weak-contract.ll
weak-copies.ll
weak-dce.ll
weak.ll