1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/test/Transforms
Chandler Carruth a61218ea75 [PM/LoopUnswitch] Fix PR37651 by correctly invalidating SCEV when
unswitching loops.

Original patch trying to address this was sent in D47624, but that
didn't quite handle things correctly. There are two key principles used
to select whether and how to invalidate SCEV-cached information about
loops:

1) We must invalidate any info SCEV has cached before unswitching as we
   may change (or destroy) the loop structure by the act of unswitching,
   and make it hard to recover everything we want to invalidate within
   SCEV.

2) We need to invalidate all of the loops whose CFGs are mutated by the
   unswitching. Notably, this isn't the *entire* loop nest, this is
   every loop contained by the outermost loop reached by an exit block
   relevant to the unswitch.

And we need to do this even when doing trivial unswitching.

I've added more focused tests that directly check that SCEV starts off
with imprecise information and after unswitching (and simplifying
instructions) re-querying SCEV will produce precise information. These
tests also specifically work to check that an *outer* loop's information
becomes precise.

However, the testing here is still a bit imperfect. Crafting test cases
that reliably fail to be analyzed by SCEV before unswitching and succeed
afterward proved ... very, very hard. It took me several hours and
careful work to build these, and I'm not optimistic about necessarily
coming up with more to cover more elaborate possibilities. Fortunately,
the code pattern we are testing here in the pass is really
straightforward and reliable.

Thanks to Max Kazantsev for the initial work on this as well as the
review, and to Hal Finkel for helping me talk through approaches to test
this stuff even if it didn't come to much.

Differential Revision: https://reviews.llvm.org/D47624

llvm-svn: 336183
2018-07-03 09:13:27 +00:00
..
ADCE [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
AddDiscriminators [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
AggressiveInstCombine [AggressiveInstCombine] avoid crashing on unsimplified code (PR37446) 2018-05-14 13:43:32 +00:00
AlignmentFromAssumptions
ArgumentPromotion
AtomicExpand
BDCE [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
BlockExtractor
BranchFolding
CalledValuePropagation
CallSiteSplitting [CallSiteSplit] Make sure we remove nonnull if the parameter turns out to be a constant. 2018-04-23 20:09:08 +00:00
CodeExtractor [CodeExtractor] Allow extracting blocks with exception handling 2018-05-11 22:49:49 +00:00
CodeGenPrepare Implement strip.invariant.group 2018-07-02 04:49:30 +00:00
ConstantHoisting [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
ConstantMerge
ConstProp Make uitofp and sitofp defined on overflow. 2018-06-14 22:58:48 +00:00
Coroutines [Coroutines] PR34897: Fix incorrect elisions 2018-05-11 03:12:28 +00:00
CorrelatedValuePropagation [ValueTracking] Fix endless recursion in isKnownNonZero() 2018-05-30 15:56:46 +00:00
CrossDSOCFI
DCE
DeadArgElim [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
DeadStoreElimination Implement strip.invariant.group 2018-07-02 04:49:30 +00:00
DivRemPairs
EarlyCSE [EarlyCSE] Propagate conditions of AND and OR instructions 2018-06-14 13:02:13 +00:00
EliminateAvailableExternally
EntryExitInstrumenter [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
ExpandMemCmp/X86
Float2Int
ForcedFunctionAttrs
FunctionAttrs Implement strip.invariant.group 2018-07-02 04:49:30 +00:00
FunctionImport [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
GCOVProfiling [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
GlobalDCE
GlobalMerge [GlobalMerge] Set the alignment on merged global structs 2018-06-06 14:48:32 +00:00
GlobalOpt Implement strip.invariant.group 2018-07-02 04:49:30 +00:00
GlobalSplit
GuardWidening [LoopGuardWidening] Make PostDomTree optional 2018-04-27 23:15:56 +00:00
GVN Implement strip.invariant.group 2018-07-02 04:49:30 +00:00
GVNHoist [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
GVNSink
IndirectBrExpand
IndVarSimplify [IndVarSimplify] Ignore unreachable users of truncs 2018-06-28 08:20:03 +00:00
InferAddressSpaces
InferFunctionAttrs [SimplifyLibcalls] Replace locked IO with unlocked IO 2018-05-16 11:39:52 +00:00
Inline [ThinLTO] Port InlinerFunctionImportStats handling to new PM 2018-06-28 20:07:47 +00:00
InstCombine [InstCombine] Delay foldICmpUsingKnownBits until simple transforms are done 2018-07-03 06:23:57 +00:00
InstMerge [MergedLoadStoreMotion] Fix a debug invariant bug in mergeStores 2018-05-09 06:52:12 +00:00
InstNamer
InstSimplify [InstSimplify] fold shifts by sext bool 2018-06-26 17:31:38 +00:00
InterleavedAccess
Internalize
IPConstantProp Revert r335206 "Recommit r333268: [IPSCCP] Use PredicateInfo to propagate facts from cmp instructions." 2018-06-21 19:18:36 +00:00
IRCE [IRCE] Fix miscompile with range checks against negative values 2018-05-19 13:06:37 +00:00
JumpThreading [JumpThreading] Don't try to rewrite a use if it's already valid. 2018-06-26 22:19:48 +00:00
LCSSA [Debugify] Set a DI version module flag for llc compatibility 2018-05-24 23:00:23 +00:00
LICM Fix invariant fdiv hoisting in LICM 2018-06-23 04:01:28 +00:00
LoadStoreVectorizer [AMDGPU] Re-enabled 128bit wide-vector generation for local addr space by default. 2018-05-28 18:15:11 +00:00
LoopDataPrefetch [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
LoopDeletion
LoopDistribute [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
LoopIdiom [ValueTracking] Match select abs pattern when there's an sext involved 2018-06-04 16:53:57 +00:00
LoopInstSimplify [LoopInstSimplify] Re-implement the core logic of loop-instsimplify to 2018-05-29 20:15:38 +00:00
LoopInterchange [DA] Enable -da-delinearize by default 2018-06-21 11:53:16 +00:00
LoopLoadElim
LoopPredication
LoopReroll [LoopReroll] Rewrite induction variable rewriting. 2018-06-22 22:58:55 +00:00
LoopRotate [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
LoopSimplify [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
LoopSimplifyCFG Generalize MergeBlockIntoPredecessor. Replace uses of MergeBasicBlockIntoOnlyPred. 2018-06-20 22:01:04 +00:00
LoopStrengthReduce SCEVExpander::expandAddRecExprLiterally(): check before casting as Instruction 2018-06-29 07:44:20 +00:00
LoopUnroll LoopUnroll: Allow analyzing intrinsic call costs 2018-06-26 18:51:17 +00:00
LoopUnrollAndJam [UnrollAndJam] New Unroll and Jam pass 2018-07-01 12:47:30 +00:00
LoopUnswitch [LoopUnswitch] Fix SCEV invalidation in unswitching 2018-05-23 10:09:53 +00:00
LoopVectorize [InstCombine] Delay foldICmpUsingKnownBits until simple transforms are done 2018-07-03 06:23:57 +00:00
LoopVersioning [SCEV] Strengthen StrengthenNoWrapFlags (reapply r334428). 2018-07-02 20:01:54 +00:00
LoopVersioningLICM
LowerAtomic
LowerExpectIntrinsic
LowerGuardIntrinsic
LowerInvoke
LowerSwitch
LowerTypeTests In thin and full LTO + CFI, direct function calls may go through jump table 2018-06-04 18:18:12 +00:00
Mem2Reg Improve ConvertDebugDeclareToDebugValue 2018-06-26 06:17:00 +00:00
MemCpyOpt [MemCpyOpt] Skip optimizing basic blocks not reachable from entry 2018-04-23 19:55:04 +00:00
MergeFunc [MergeFunctions] Fix merging of small weak functions 2018-05-15 11:31:07 +00:00
MergeICmps [MergeICmps] Don't crash when memcmp is not available 2018-05-19 12:51:59 +00:00
MetaRenamer
NameAnonGlobals
NaryReassociate [NaryReassociate] Detect deleted instr with WeakVH 2018-05-24 06:09:02 +00:00
NewGVN Implement strip.invariant.group 2018-07-02 04:49:30 +00:00
ObjCARC [ObjCARC] Prevent code motion into a catchswitch 2018-05-16 04:52:18 +00:00
PartiallyInlineLibCalls
PGOProfile [ICP] Do not attempt type matching for variable length arguments. 2018-04-25 17:19:21 +00:00
PhaseOrdering [PhaseOrdering] remove stale comments; NFC 2018-05-09 23:10:46 +00:00
PlaceSafepoints
PreISelIntrinsicLowering
PruneEH
Reassociate [Reassociate] Prevent infinite loops when processing PHIs. 2018-05-11 15:45:36 +00:00
Reg2Mem
RewriteStatepointsForGC
SafeStack [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
SampleProfile [SampleFDO] Add a new compact binary format for sample profile. 2018-06-11 22:40:43 +00:00
Scalarizer [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
SCCP Recommit r328307: [IPSCCP] Use constant range information for comparisons of parameters. 2018-07-02 12:44:04 +00:00
SeparateConstOffsetFromGEP [Split GEP] handle trunc() in separate-const-offset-from-gep pass. 2018-05-11 21:13:19 +00:00
SimpleLoopUnswitch [PM/LoopUnswitch] Fix PR37651 by correctly invalidating SCEV when 2018-07-03 09:13:27 +00:00
SimplifyCFG Revert "Simplify blockaddress usage before giving up in MergeBlockIntoPredecessor" 2018-06-18 23:20:08 +00:00
Sink
SLPVectorizer [SLP] Recognize min/max pattern using instructions producing same values. 2018-07-02 17:55:31 +00:00
SpeculateAroundPHIs
SpeculativeExecution
SROA [SROA] Preserve DebugLoc when rewriting alloca partitions 2018-06-28 18:58:30 +00:00
StraightLineStrengthReduce
StripDeadPrototypes
StripSymbols
StructurizeCFG StructurizeCFG: Adjust the loop depth for a subregion to order the nodes correctly 2018-05-23 18:34:48 +00:00
SyntheticCountsPropagation
TailCallElim [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
ThinLTOBitcodeWriter [ThinLTOBitcodeWriter] Emit summaries for regular LTO modules 2018-06-01 15:20:47 +00:00
Util [PredicateInfo] Order instructions in different BBs by DFSNumIn. 2018-06-20 17:42:01 +00:00
WholeProgramDevirt