1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/lib/Transforms/Scalar
Sebastian Pop 93d67e228d DA: remove uses of GEP, only ask SCEV
It's been quite some time the Dependence Analysis (DA) is broken,
as it uses the GEP representation to "identify" multi-dimensional arrays.
It even wrongly detects multi-dimensional arrays in single nested loops:

from test/Analysis/DependenceAnalysis/Coupled.ll, example @couple6
;; for (long int i = 0; i < 50; i++) {
;; A[i][3*i - 6] = i;
;; *B++ = A[i][i];

DA used to detect two subscripts, which makes no sense in the LLVM IR
or in C/C++ semantics, as there are no guarantees as in Fortran of
subscripts not overlapping into a next array dimension:

maximum nesting levels = 1
SrcPtrSCEV = %A
DstPtrSCEV = %A
using GEPs
subscript 0
    src = {0,+,1}<nuw><nsw><%for.body>
    dst = {0,+,1}<nuw><nsw><%for.body>
    class = 1
    loops = {1}
subscript 1
    src = {-6,+,3}<nsw><%for.body>
    dst = {0,+,1}<nuw><nsw><%for.body>
    class = 1
    loops = {1}
Separable = {}
Coupled = {1}

With the current patch, DA will correctly work on only one dimension:

maximum nesting levels = 1
SrcSCEV = {(-2424 + %A)<nsw>,+,1212}<%for.body>
DstSCEV = {%A,+,404}<%for.body>
subscript 0
    src = {(-2424 + %A)<nsw>,+,1212}<%for.body>
    dst = {%A,+,404}<%for.body>
    class = 1
    loops = {1}
Separable = {0}
Coupled = {}

This change removes all uses of GEP from DA, and we now only rely
on the SCEV representation.

The patch does not turn on -da-delinearize by default, and so the DA analysis
will be more conservative in the case of multi-dimensional memory accesses in
nested loops.

I disabled some interchange tests, as the DA is not able to disambiguate
the dependence anymore. To make DA stronger, we may need to
compute a bound on the number of iterations based on the access functions
and array dimensions.

The patch cleans up all the CHECKs in test/Transforms/LoopInterchange/*.ll to
avoid checking for snippets of LLVM IR: this form of checking is very hard to
maintain. Instead, we now check for output of the pass that are more meaningful
than dozens of lines of LLVM IR. Some tests now require -debug messages and thus
only enabled with asserts.

Patch written by Sebastian Pop and Aditya Kumar.

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

llvm-svn: 326837
2018-03-06 21:55:59 +00:00
..
ADCE.cpp
AlignmentFromAssumptions.cpp [AlignmentFromAssumptions] Set source and dest alignments of memory intrinsiscs separately 2018-02-22 18:55:59 +00:00
BDCE.cpp [BDCE] Salvage debug info from dying insts 2018-02-21 01:55:33 +00:00
CallSiteSplitting.cpp [CallSiteSplitting] Do not crash when BB's terminator changes. 2018-03-06 14:00:58 +00:00
CMakeLists.txt Add a new pass to speculate around PHI nodes with constant (integer) operands when profitable. 2017-11-28 11:32:31 +00:00
ConstantHoisting.cpp
ConstantProp.cpp
CorrelatedValuePropagation.cpp [CVP] fix formatting; NFC 2018-03-05 16:08:34 +00:00
DCE.cpp [DCE] Salvage debug info from dead insts 2018-02-15 22:26:18 +00:00
DeadStoreElimination.cpp [DSE] Don't DSE stores that subsequent memmove calls read from 2018-02-20 23:19:34 +00:00
DivRemPairs.cpp
EarlyCSE.cpp [EarlyCSE] Salvage debug info during DCE 2018-01-09 15:08:37 +00:00
FlattenCFGPass.cpp
Float2Int.cpp
GuardWidening.cpp
GVN.cpp [GVN] Partially revert debug info salvage change (r325063) 2018-02-16 01:15:20 +00:00
GVNHoist.cpp Add missed PostDominatorTree analysis dependency to GVN hoist pass. 2018-02-08 11:45:36 +00:00
GVNSink.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
InductiveRangeCheckElimination.cpp [NFC] Fix typos 2018-02-12 05:16:28 +00:00
IndVarSimplify.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
InferAddressSpaces.cpp [InferAddressSpaces] Update uses of IRBuilder memory intrinsic creation to new API 2018-02-06 20:33:36 +00:00
IVUsersPrinter.cpp
JumpThreading.cpp [JumpThreading] PR36133 enable/disable DominatorTree for LVI analysis 2018-02-16 16:35:17 +00:00
LICM.cpp Move llvm::computeLoopSafetyInfo from LICM.cpp to LoopUtils.cpp. NFC 2018-02-14 18:34:53 +00:00
LLVMBuild.txt Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
LoopAccessAnalysisPrinter.cpp
LoopDataPrefetch.cpp [NFC] fix trivial typos in comments 2018-01-19 10:55:29 +00:00
LoopDeletion.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
LoopDistribute.cpp [Dominators] Remove verifyDomTree and add some verifying for Post Dom Trees 2018-02-28 11:00:08 +00:00
LoopIdiomRecognize.cpp [LoopIdiom] Be more aggressive when setting alignment in memcpy 2018-02-08 17:33:08 +00:00
LoopInstSimplify.cpp
LoopInterchange.cpp DA: remove uses of GEP, only ask SCEV 2018-03-06 21:55:59 +00:00
LoopLoadElimination.cpp Add MemorySSA as loop dependency, disabled by default [NFC]. 2017-11-21 15:45:46 +00:00
LoopPassManager.cpp
LoopPredication.cpp Rename and move utility function getLatchPredicateForGuard. NFC. 2018-02-09 07:59:07 +00:00
LoopRerollPass.cpp
LoopRotation.cpp [Debug] Add a utility to propagate dbg.value to new PHIs, NFC 2018-01-25 21:37:05 +00:00
LoopSimplifyCFG.cpp
LoopSink.cpp Add hasProfileData() to check if a function has profile data. NFC. 2017-12-22 01:33:52 +00:00
LoopStrengthReduce.cpp Revert "[LSR] Avoid UB overflow when examining reuse opportunities" 2018-02-12 22:42:13 +00:00
LoopUnrollPass.cpp LoopUnroll: respect pragma unroll when AllowRemainder is disabled 2018-03-02 16:22:32 +00:00
LoopUnswitch.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
LoopVersioningLICM.cpp This change add's optimization remark in LoopVersioning LICM pass. 2018-01-23 09:47:28 +00:00
LowerAtomic.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
LowerExpectIntrinsic.cpp
LowerGuardIntrinsic.cpp
MemCpyOptimizer.cpp Revert "[memcpyopt] Teach memcpyopt to optimize across basic blocks" 2017-12-28 05:10:33 +00:00
MergedLoadStoreMotion.cpp Mark MergedLoadStoreMotion as not preserving MemDep results 2018-02-23 10:41:57 +00:00
MergeICmps.cpp [MergeICmp] Simplify how BCECmpBlock instructions are blacklisted 2018-03-06 02:24:02 +00:00
NaryReassociate.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-17 21:27:42 +00:00
NewGVN.cpp [NewGVN] Update phi-of-ops def block when updating existing ValuePHI. 2018-02-27 09:34:51 +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
Reassociate.cpp Reassociate: add global reassociation algorithm 2017-12-12 19:18:02 +00:00
Reg2Mem.cpp
RewriteStatepointsForGC.cpp [RewriteStatepoints] Fix stale parse points 2018-03-05 22:27:30 +00:00
Scalar.cpp [PM] port Rewrite Statepoints For GC to the new pass manager. 2017-12-15 09:32:11 +00:00
Scalarizer.cpp
SCCP.cpp [IPSCCP] Add getCompare which returns either true, false, undef or null. 2018-03-05 17:33:50 +00:00
SeparateConstOffsetFromGEP.cpp Adding a width of the GEP index to the Data Layout. 2018-02-14 06:58:08 +00:00
SimpleLoopUnswitch.cpp [Dominators] Remove verifyDomTree and add some verifying for Post Dom Trees 2018-02-28 11:00:08 +00:00
SimplifyCFGPass.cpp [SimplifyCFG] don't sink common insts too soon (PR34603) 2017-12-14 22:05:20 +00:00
Sink.cpp [Sink] Really really fix predicate in legality check 2018-01-11 21:28:57 +00:00
SpeculateAroundPHIs.cpp Add a new pass to speculate around PHI nodes with constant (integer) operands when profitable. 2017-11-28 11:32:31 +00:00
SpeculativeExecution.cpp
SROA.cpp [Transforms] Propagate TBAA info in SROA 2018-02-16 10:10:29 +00:00
StraightLineStrengthReduce.cpp
StructurizeCFG.cpp Revert "StructurizeCFG: Test for branch divergence correctly" 2018-02-24 17:29:09 +00:00
TailRecursionElimination.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00