1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
llvm-mirror/test/Transforms
George Burgess IV 48f0f2dd73 [MemorySSA] Change how the walker views/walks visited phis.
This patch teaches the caching MemorySSA walker a few things:

1. Not to walk Phis we've walked before. It seems that we tried to do
   this before, but it didn't work so well in cases like:

define void @foo() {
  %1 = alloca i8
  %2 = alloca i8
  br label %begin

begin:
  ; 3 = MemoryPhi({%0,liveOnEntry},{%end,2})
  ; 1 = MemoryDef(3)
  store i8 0, i8* %2
  br label %end

end:
  ; MemoryUse(?)
  load i8, i8* %1
  ; 2 = MemoryDef(1)
  store i8 0, i8* %2
  br label %begin
}

Because we wouldn't put Phis in Q.Visited until we tried to visit them.
So, when trying to optimize MemoryUse(?):
  - We would visit 3 above
    - ...Which would make us put {%0,liveOnEntry} in Q.Visited
    - ...Which would make us visit {%0,liveOnEntry}
    - ...Which would make us put {%end,2} in Q.Visited
    - ...Which would make us visit {%end,2}
      - ...Which would make us visit 3
        - ...Which would realize we've already visited everything in 3
        - ...Which would make us conservatively return 3.

In the added test-case, (@looped_visitedonlyonce) this behavior would
cause us to give incorrect results. Specifically, we'd visit 4 twice
in the same query, but on the second visit, we'd skip while.cond because
it had been visited, visit if.then/if.then2, and cache "1" as the
clobbering def on the way back.

2. If we try to walk the defs of a {Phi,MemLoc} and see it has been
   visited before, just hand back the Phi we're trying to optimize.

I promise this isn't as terrible as it seems. :)

We now insert {Phi,MemLoc} pairs just before walking the Phi's upward
defs. So, we check the cache for the {Phi,MemLoc} pair before checking
if we've already walked the Phi.

The {Phi,MemLoc} pair is (almost?) always guaranteed to have a cache
entry if we've already fully walked it, because we cache as we go.

So, if the {Phi,MemLoc} pair isn't in cache, either:
 (a) we must be in the process of visiting it (in which case, we can't
     give a better answer in a cache-as-we-go DFS walker)

 (b) we visited it, but didn't cache it on the way back (...which seems
     to require `ModifyingAccess` to not dominate `StartingAccess`,
     so I'm 99% sure that would be an error. If it's not an error, I
     haven't been able to get it to happen locally, so I suspect it's
     rare.)

- - - - -

As a consequence of this change, we no longer skip upward defs of phis,
so we can kill the `VisitedOnlyOne` check. This gives us better accuracy
than we had before, at the cost of potentially doing a bit more work
when we have a loop.

llvm-svn: 264814
2016-03-30 00:26:26 +00:00
..
ADCE ADCE: Remove debug info intrinsics in dead scopes 2016-03-29 22:57:12 +00:00
AddDiscriminators Remove llvm::getDISubprogram in favor of Function::getSubprogram 2016-03-11 02:14:16 +00:00
AlignmentFromAssumptions Revert "Change memcpy/memset/memmove to have dest and source alignments." 2015-11-19 05:56:52 +00:00
ArgumentPromotion DI: Reverse direction of subprogram -> function edge. 2015-11-05 22:03:56 +00:00
AtomicExpand ARM: sink atomic release barrier as far as possible into cmpxchg. 2016-02-22 20:55:50 +00:00
BBVectorize Have a single way for creating unique value names. 2015-11-22 00:16:24 +00:00
BDCE
BranchFolding Move branch folding test to a better location. 2015-12-03 19:41:25 +00:00
CodeExtractor
CodeGenPrepare Keep CodeGenPrepare from preserving the domtree. 2016-03-22 21:25:08 +00:00
ConstantHoisting
ConstantMerge [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
ConstProp IR: Make ConstantDataArray::getFP actually return a ConstantDataArray 2015-12-09 21:21:07 +00:00
CorrelatedValuePropagation [CVP] Convert an SDiv to a UDiv if both operands are known to be nonnegative 2016-03-14 03:24:28 +00:00
CrossDSOCFI [cfi] Cross-DSO CFI diagnostic mode (LLVM part). 2016-01-25 23:35:03 +00:00
DeadArgElim [OperandBundles] Have DeadArgElim play nice with operand bundles 2015-12-23 09:58:36 +00:00
DeadStoreElimination Allow value forwarding past release fences in GVN 2016-03-25 22:40:35 +00:00
EarlyCSE Fix several accidental DOS line endings in source files 2016-01-03 17:22:03 +00:00
EliminateAvailableExternally
Float2Int [Float2Int] Don't operate on vector instructions 2015-12-09 21:08:18 +00:00
ForcedFunctionAttrs [attrs] Split off the forced attributes utility into its own pass that 2015-12-27 08:13:45 +00:00
FunctionAttrs [attrs] Handle convergent CallSites. 2016-03-14 20:18:54 +00:00
FunctionImport llvm/test/Transforms/FunctionImport/funcimport.ll: -stats REQUIRES +Asserts. 2016-03-28 02:14:49 +00:00
GCOVProfiling [GCOV] Avoid emitting profile arcs for module and skeleton CUs 2016-01-21 17:04:42 +00:00
GlobalDCE [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
GlobalOpt [GlobalOpt] Don't look through aliases when sorting names of globals. 2016-03-15 14:18:26 +00:00
GVN Allow value forwarding past release fences in GVN 2016-03-25 22:40:35 +00:00
IndVarSimplify AMDGPU: Cost model for basic integer operations 2016-03-25 01:16:40 +00:00
InferFunctionAttrs [BasicAA] Remove special casing of memset_pattern16 in favor of generic attribute inference 2016-01-06 04:53:16 +00:00
Inline Add support for no-jump-tables 2016-03-29 17:46:23 +00:00
InstCombine Upgrade some wildly anachronistic debug info in testcases. 2016-03-29 22:34:30 +00:00
InstMerge fixed typo - CHECK-LABEL 2016-03-29 06:49:38 +00:00
InstSimplify [InstSimplify] regenerate checks using a script 2016-03-25 20:12:25 +00:00
Internalize [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
IPConstantProp [SCCP] Don't violate the lattice invariants 2016-01-07 21:36:16 +00:00
IRCE [SCEV] Try to reuse existing value during SCEV expansion 2016-02-04 01:27:38 +00:00
JumpThreading [JumpThreading] See through Cast Instructions 2016-03-16 04:52:52 +00:00
LCSSA [WinEH] Update LCSSA to handle catchswitch with handlers inside and outside a loop 2015-12-18 18:12:35 +00:00
LICM Upgrade some wildly anachronistic debug info in testcases. 2016-03-29 22:34:30 +00:00
LoadCombine
LoopDataPrefetch [LoopDataPrefetch] Centralize the tuning cl::opts under the pass 2016-03-29 23:45:52 +00:00
LoopDeletion
LoopDistribute Allow LLE/LD and the loop versioning infrastructure to use SCEV predicates 2015-11-09 13:26:09 +00:00
LoopIdiom Add an IR Verifier check for orphaned DICompileUnits. 2016-03-28 21:06:26 +00:00
LoopInterchange
LoopLoadElim [LLE] Check for mismatching types between the store and the load earlier 2016-03-24 17:59:26 +00:00
LoopReroll [PATCH] Force LoopReroll to reset the loop trip count value after reroll. 2016-03-22 13:50:57 +00:00
LoopRotate Upgrade some wildly anachronistic debug info in testcases. 2016-03-29 22:34:30 +00:00
LoopSimplify DI: Reverse direction of subprogram -> function edge. 2015-11-05 22:03:56 +00:00
LoopSimplifyCFG Add LoopSimplifyCFG pass 2016-01-29 22:35:36 +00:00
LoopStrengthReduce [LoopStrengthReduce] Don't hoist into a catchswitch 2016-03-24 21:40:22 +00:00
LoopUnroll Enable non-power-of-2 #pragma unroll counts. 2016-03-25 14:24:52 +00:00
LoopUnswitch [SimlifyCFG] Prevent passes from destroying canonical loop structure, especially for nested loops 2016-03-29 04:08:57 +00:00
LoopVectorize [Verifier] Reject PHIs using defs from own block. 2016-03-26 23:32:57 +00:00
LoopVersioning [LVers] Change CHECK_LABEL to CHECK-LABEL (underscore->dash) 2016-03-28 21:04:13 +00:00
LoopVersioningLICM Corrected tests for Loop Versioning LICM, by adding “REQUIRES: asserts”. 2016-02-06 12:34:41 +00:00
LowerAtomic
LowerBitSets [cfi] Fix LowerBitSets on 32-bit targets. 2015-12-21 22:14:04 +00:00
LowerExpectIntrinsic [PM] Port StripDeadPrototypes to the new pass manager 2015-10-30 23:28:12 +00:00
LowerInvoke
LowerSwitch Have a single way for creating unique value names. 2015-11-22 00:16:24 +00:00
Mem2Reg [Mem2Reg] Respect optnone 2015-12-11 13:36:59 +00:00
MemCpyOpt Imporove load to store => memcpy 2016-03-14 22:52:27 +00:00
MergeFunc [IR] Remove terminatepad 2015-12-14 18:34:23 +00:00
MetaRenamer Revert "Change memcpy/memset/memmove to have dest and source alignments." 2015-11-19 05:56:52 +00:00
NaryReassociate [NaryReassociate] allow candidate to have a different type 2015-12-18 21:36:30 +00:00
ObjCARC [ObjCARC] Handle ARCInstKind::ClaimRV in OptimizeIndividualCalls. 2016-02-17 18:51:27 +00:00
PartiallyInlineLibCalls
PGOProfile [PGO] Skip value profile instrumentation of inline asm 2016-03-11 18:57:48 +00:00
PhaseOrdering
PlaceSafepoints [PlaceSafepoints] Clamp NoStatepoints to true 2016-01-28 21:51:14 +00:00
PruneEH [PruneEH] Don't try to insert a terminator after another terminator 2016-01-23 06:00:44 +00:00
Reassociate Reassociate: Reprocess RedoInsts after each inst 2016-01-26 18:42:36 +00:00
Reg2Mem
RewriteStatepointsForGC [RS4GC] Lower calls to @llvm.experimental.deoptimize 2016-03-25 20:12:13 +00:00
SafeStack [safestack] Make sure the unsafe stack pointer is popped in all cases 2016-02-02 01:03:11 +00:00
SampleProfile Perform InstructioinCombiningPass before SampleProfile pass. 2016-03-01 22:53:02 +00:00
Scalarizer DI: Reverse direction of subprogram -> function edge. 2015-11-05 22:03:56 +00:00
ScalarRepl Revert "Change memcpy/memset/memmove to have dest and source alignments." 2015-11-19 05:56:52 +00:00
SCCP [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
SeparateConstOffsetFromGEP [ValueTracking] Remove dead code from an old experiment 2016-03-03 19:44:06 +00:00
SimplifyCFG Upgrade some wildly anachronistic debug info in testcases. 2016-03-29 22:34:30 +00:00
Sink [IR] Reformulate LLVM's EH funclet IR 2015-12-12 05:38:55 +00:00
SLPVectorizer Fix tests that used CHECK-NEXT-NOT and CHECK-DAG-NOT. 2016-02-26 19:40:34 +00:00
SpeculativeExecution
SROA Have DataLayout::isLegalInteger() accept uint64_t 2016-03-18 23:19:29 +00:00
StraightLineStrengthReduce
StripDeadPrototypes [PM] Port StripDeadPrototypes to the new pass manager 2015-10-30 23:28:12 +00:00
StripSymbols Upgrade some wildly anachronistic debug info in testcases. 2016-03-29 22:34:30 +00:00
StructurizeCFG AMDGPU: Remove some old intrinsic uses from tests 2016-02-11 06:02:01 +00:00
TailCallElim Push isDereferenceableAndAlignedPointer down into isSafeToLoadUnconditionally 2016-01-17 12:35:29 +00:00
TailDup
Util [MemorySSA] Change how the walker views/walks visited phis. 2016-03-30 00:26:26 +00:00
WholeProgramDevirt WholeProgramDevirt: introduce. 2016-02-09 22:50:34 +00:00