llvm-6502/test/Transforms/ObjCARC
Michael Gottesman 0556900b26 [objc-arc] Do not mismatch up retains inside a for loop with releases outside said for loop in the presense of differing provenance caused by escaping blocks.
This occurs due to an alloca representing a separate ownership from the
original pointer. Thus consider the following pseudo-IR:

  objc_retain(%a)
  for (...) {
    objc_retain(%a)
    %block <- %a
    F(%block)
    objc_release(%block)
  }
  objc_release(%a)

From the perspective of the optimizer, the %block is a separate
provenance from the original %a. Thus the optimizer pairs up the inner
retain for %a and the outer release from %a, resulting in segfaults.

This is fixed by noting that the signature of a mismatch of
retain/releases inside the for loop is a Use/CanRelease top down with an
None bottom up (since bottom up the Retain-CanRelease-Use-Release
sequence is completed by the inner objc_retain, but top down due to the
differing provenance from the objc_release said sequence is not
completed). In said case in CheckForCFGHazards, we now clear the state
of %a implying that no pairing will occur.

Additionally a test case is included.

rdar://12969722

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179747 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-18 05:39:45 +00:00
..
apelim.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
arc-annotations.ll Streamline arc-annotation test (removing some cases which do not add any extra coverage) and set it up to use FileCheck variables to make the test more robust. 2013-04-18 04:34:06 +00:00
basic.ll An objc_retain can serve as a use for a different pointer. 2013-04-05 22:54:32 +00:00
cfg-hazards.ll [objc-arc] Do not mismatch up retains inside a for loop with releases outside said for loop in the presense of differing provenance caused by escaping blocks. 2013-04-18 05:39:45 +00:00
clang-arc-used-intrinsic-removed-if-isolated.ll Add clang.arc.used to ModuleHasARC so ARC always runs if said call is present in a module. 2013-03-29 21:15:23 +00:00
contract-marker.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
contract-storestrong-ivar.ll
contract-storestrong.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
contract-testcases.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
contract.ll Kill every call to @clang.arc.use in the ARC contract phase. 2013-03-22 21:38:36 +00:00
empty-block.ll
ensure-that-exception-unwind-path-is-visited.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
escape.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
expand.ll
gvn.ll This test is only supposed to test that the objc-arc alias analysis 2013-01-22 04:41:11 +00:00
intrinsic-use.ll Properly model precise lifetime when given an incomplete dataflow sequence. 2013-04-05 22:54:28 +00:00
invoke.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
lit.local.cfg
move-and-form-retain-autorelease.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
move-and-merge-autorelease.ll
nested.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
no-objc-arc-exceptions.ll [ObjCARC] Strength reduce objc_retainBlock -> objc_retain if the objc_retainBlock is optimizable. 2013-03-28 20:11:19 +00:00
path-overflow.ll
pointer-types.ll
post-inlining.ll
pr12270.ll
retain-block-alloca.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
retain-block-escape-analysis.ll Properly model precise lifetime when given an incomplete dataflow sequence. 2013-04-05 22:54:28 +00:00
retain-block-load.ll
retain-block-side-effects.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
retain-block.ll Non optimizable objc_retainBlock calls are not forwarding. 2013-03-28 20:11:30 +00:00
retain-not-declared.ll Updated test0 of retain-not-declared.ll to reflect the fact that objc-arc-expand runs before objc-arc/objc-arc-contract. 2013-03-29 22:44:59 +00:00
rle-s2l.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
rv.ll Remove an optimization where we were changing an objc_autorelease into an objc_autoreleaseReturnValue. 2013-04-03 02:57:24 +00:00
split-backedge.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
tail-call-invariant-enforcement.ll Remove an optimization where we were changing an objc_autorelease into an objc_autoreleaseReturnValue. 2013-04-03 02:57:24 +00:00
weak-contract.ll
weak-copies.ll Use references to attribute groups on the call/invoke instructions. 2013-02-22 09:09:42 +00:00
weak-dce.ll
weak.ll