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 Set the "tail" flag on pattern-matched objc_storeStrong calls. 2012-01-19 19:14:36 +00:00
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 When eliminating unnecessary retain+autorelease on return values, 2011-09-29 22:27:34 +00:00
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 Replace all instances of dg.exp file with lit.local.cfg, since all tests are run with LIT now and now Dejagnu. dg.exp is no longer needed. 2012-02-16 06:28:33 +00:00
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 Detect overflow in the path count computation. rdar://12277446. 2012-09-12 20:45:17 +00:00
pointer-types.ll It turns out that clang does use pointer-to-function types to 2011-12-14 19:10:53 +00:00
post-inlining.ll
pr12270.ll Tests: rewrite 'opt ... %s' to 'opt ... < %s' so that opt does not emit a ModuleID 2012-12-30 02:33:22 +00:00
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 Just like in regular escape analysis, loads and stores through 2012-02-13 22:57:02 +00:00
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 Fix replacing all the users of objc weak runtime routines 2012-05-18 22:17:29 +00:00
weak.ll