llvm-6502/test/Transforms
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
..
ADCE
ArgumentPromotion
BBVectorize CostModel: increase the default cost of supported floating point operations from 1 to two. Fixed a few tests that changes because now the cost of one insert + a vector operation on two doubles is lower than two scalar operations on doubles. 2013-04-12 21:15:03 +00:00
BlockPlacement
BranchFolding
CodeExtractor
CodeGenPrepare
ConstantMerge
ConstProp
CorrelatedValuePropagation
DeadArgElim Revert "Adding DIImportedModules to DIScopes." 2013-03-28 02:44:59 +00:00
DeadStoreElimination
EarlyCSE
FunctionAttrs
GCOVProfiling Revert "Adding DIImportedModules to DIScopes." 2013-03-28 02:44:59 +00:00
GlobalDCE GlobalDCE: Fix an oversight in my last commit that could lead to crashes. 2013-04-13 16:11:14 +00:00
GlobalOpt Use a worklist to avoid a sneaky iterator invalidation. 2013-04-02 08:16:45 +00:00
GVN Revert 179071 because it is not the right way to support non standard new/new[] operators. 2013-04-09 04:43:46 +00:00
IndVarSimplify
Inline
InstCombine Do not optimise fprintf() calls if its return value is used. 2013-04-17 02:01:10 +00:00
InstSimplify Add missing colons to check lines. 2013-04-11 12:41:41 +00:00
Internalize
IPConstantProp
JumpThreading
LCSSA
LICM
LoopDeletion
LoopIdiom
LoopRotate
LoopSimplify
LoopStrengthReduce
LoopUnroll
LoopUnswitch
LoopVectorize LoopVectorizer: integer division is not a reduction operation 2013-04-12 15:15:19 +00:00
LowerAtomic
LowerExpectIntrinsic
LowerInvoke
LowerSwitch
Mem2Reg Revert "Adding DIImportedModules to DIScopes." 2013-03-28 02:44:59 +00:00
MemCpyOpt
MergeFunc We are not able to bitcast a pointer to an integral value. 2013-04-15 22:33:50 +00:00
MetaRenamer
ObjCARC [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
PhaseOrdering
PruneEH
Reassociate Correct assertion condition 2013-04-01 18:13:05 +00:00
Reg2Mem
ScalarRepl Disable the optimization about promoting vector-element-access with symbolic index. 2013-04-05 21:07:08 +00:00
SCCP
SimplifyCFG simplifycfg: Fix integer overflow converting switch into icmp. 2013-04-16 08:35:36 +00:00
SimplifyLibCalls
Sink
SLPVectorizer SLPVectorizer: Make it a function pass and add code for hoisting the vector-gather sequence out of loops. 2013-04-15 22:00:26 +00:00
SROA Fix PR15674 (and PR15603): a SROA think-o. 2013-04-07 11:47:54 +00:00
StripSymbols
TailCallElim
TailDup