1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
llvm-mirror/lib/Transforms/Scalar
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.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
AlignmentFromAssumptions.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
BDCE.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
CallSiteSplitting.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
CMakeLists.txt [UnrollAndJam] New Unroll and Jam pass 2018-07-01 12:47:30 +00:00
ConstantHoisting.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
ConstantProp.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
CorrelatedValuePropagation.cpp CorrelatedValuePropagation: Preserve DT. 2018-06-16 18:57:31 +00:00
DCE.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
DeadStoreElimination.cpp [NFC] fix trivial typos in comments 2018-06-14 05:41:49 +00:00
DivRemPairs.cpp [DivRemPairs] Fix non-determinism in use list order. 2018-04-25 02:17:56 +00:00
EarlyCSE.cpp [EarlyCSE] Fix MSVC build. NFCI. 2018-06-14 14:22:03 +00:00
FlattenCFGPass.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
Float2Int.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
GuardWidening.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
GVN.cpp [NFC] fix trivial typos in comments 2018-06-14 05:41:49 +00:00
GVNHoist.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
GVNSink.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
InductiveRangeCheckElimination.cpp [IRCE] Fix miscompile with range checks against negative values 2018-05-19 13:06:37 +00:00
IndVarSimplify.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
InferAddressSpaces.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
InstSimplifyPass.cpp [instsimplify] Move the instsimplify pass to use more obvious file names 2018-06-29 23:36:03 +00:00
IVUsersPrinter.cpp [PM] Separate the LoopAnalysisManager from the LoopPassManager and move 2017-01-11 09:43:56 +00:00
JumpThreading.cpp [JumpThreading] Don't try to rewrite a use if it's already valid. 2018-06-26 22:19:48 +00:00
LICM.cpp Replace "Replacable" with "Replaceable". [NFC] 2018-07-02 18:53:40 +00:00
LLVMBuild.txt Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
LoopAccessAnalysisPrinter.cpp [PM] Separate the LoopAnalysisManager from the LoopPassManager and move 2017-01-11 09:43:56 +00:00
LoopDataPrefetch.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
LoopDeletion.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
LoopDistribute.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
LoopIdiomRecognize.cpp [LoopIdiomRecognize] Fix a couple places where it appears we were unintenionally making copies of DebugLoc. 2018-06-25 20:45:45 +00:00
LoopInstSimplify.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
LoopInterchange.cpp [LoopInterchange] Move PHI handling to adjustLoopBranches. 2018-06-19 08:03:24 +00:00
LoopLoadElimination.cpp Use SmallPtrSet explicitly for SmallSets with pointer types (NFC). 2018-06-12 11:16:56 +00:00
LoopPassManager.cpp [PM] Teach LoopUnroll to update the LPM infrastructure as it unrolls 2017-01-25 02:49:01 +00:00
LoopPredication.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
LoopRerollPass.cpp [LoopReroll] Rewrite induction variable rewriting. 2018-06-22 22:58:55 +00:00
LoopRotation.cpp Refine the loop rotation's API 2018-04-19 20:29:43 +00:00
LoopSimplifyCFG.cpp Generalize MergeBlockIntoPredecessor. Replace uses of MergeBasicBlockIntoOnlyPred. 2018-06-20 22:01:04 +00:00
LoopSink.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
LoopStrengthReduce.cpp [NFC] fix trivial typos in comments 2018-06-14 05:41:49 +00:00
LoopUnrollAndJamPass.cpp [UnrollAndJam] New Unroll and Jam pass 2018-07-01 12:47:30 +00:00
LoopUnrollPass.cpp [UnrollAndJam] New Unroll and Jam pass 2018-07-01 12:47:30 +00:00
LoopUnswitch.cpp [LoopUnswitch]Fix comparison for DomTree updates. 2018-06-22 17:14:35 +00:00
LoopVersioningLICM.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
LowerAtomic.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
LowerExpectIntrinsic.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
LowerGuardIntrinsic.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
MemCpyOptimizer.cpp [NFC] fix trivial typos in comments 2018-06-14 05:41:49 +00:00
MergedLoadStoreMotion.cpp [STLExtras] Add size() for ranges, and remove distance() 2018-05-16 23:20:42 +00:00
MergeICmps.cpp [MergeICmps] Don't crash when memcmp is not available 2018-05-19 12:51:59 +00:00
NaryReassociate.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
NewGVN.cpp Revert "Extend CFGPrinter and CallPrinter with Heat Colors" 2018-06-29 17:48:58 +00:00
PartiallyInlineLibCalls.cpp [PartiallyInlineLibCalls][x86] add TTI hook to allow sqrt inlining to depend on arg rather than result 2017-11-27 21:15:43 +00:00
PlaceSafepoints.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
Reassociate.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
Reg2Mem.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
RewriteStatepointsForGC.cpp [NFC] fix trivial typos in comments 2018-06-14 05:41:49 +00:00
Scalar.cpp [UnrollAndJam] New Unroll and Jam pass 2018-07-01 12:47:30 +00:00
Scalarizer.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-20 21:47:29 +00:00
SCCP.cpp Recommit r328307: [IPSCCP] Use constant range information for comparisons of parameters. 2018-07-02 12:44:04 +00:00
SeparateConstOffsetFromGEP.cpp [NFC] fix trivial typos in comments 2018-06-14 05:41:49 +00:00
SimpleLoopUnswitch.cpp [PM/LoopUnswitch] Fix PR37651 by correctly invalidating SCEV when 2018-07-03 09:13:27 +00:00
SimplifyCFGPass.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
Sink.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
SpeculateAroundPHIs.cpp [NFC] fix trivial typos in comments 2018-06-14 05:41:49 +00:00
SpeculativeExecution.cpp Use SmallPtrSet explicitly for SmallSets with pointer types (NFC). 2018-06-12 11:16:56 +00:00
SROA.cpp [SROA] Preserve DebugLoc when rewriting alloca partitions 2018-06-28 18:58:30 +00:00
StraightLineStrengthReduce.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
StructurizeCFG.cpp [NFC] fix trivial typos in comments 2018-06-14 05:41:49 +00:00
TailRecursionElimination.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00