llvm-project/llvm/lib
Sebastian Pop bf6e1c26cf 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
..
Analysis DA: remove uses of GEP, only ask SCEV 2018-03-06 21:55:59 +00:00
AsmParser Make the LLParser accept call instructions of variables in the program AS 2018-02-27 11:15:11 +00:00
BinaryFormat Add DWARF for discriminated unions 2018-02-06 23:45:59 +00:00
Bitcode [DebugInfo] Support DWARF v5 source code embedding extension 2018-02-23 23:01:06 +00:00
CodeGen [CodeView] Emit UdtSourceLine information for enums 2018-03-06 18:20:22 +00:00
DebugInfo [llvm-symbolizer] Use correct path when resolving .gnu_debuglink in .debug 2018-03-02 22:56:45 +00:00
Demangle Silence a bunch of implicit fallthrough warnings 2017-12-19 22:05:25 +00:00
ExecutionEngine [RuntimeDyld][MachO] Fix assertion in encodeAddend, add missing directive to 2018-03-01 01:44:33 +00:00
FuzzMutate [llvm-opt-fuzzer] Add another pack of passes for continuous fuzzing 2018-02-19 11:57:07 +00:00
Fuzzer [libFuzzer] Delete llvm/lib/Fuzzer 2017-10-16 20:48:19 +00:00
IR Refactor check for dllimport in the Verifier. 2018-03-06 17:19:23 +00:00
IRReader LLParser: add an argument for overriding data layout and do not check alloca addr space 2018-01-30 22:32:39 +00:00
LTO [LTO] Support filtering by hotness threshold 2018-02-26 18:37:45 +00:00
LineEditor
Linker [ThinLTO] Revert r325320: Import global variables 2018-03-02 23:40:08 +00:00
MC [Asm] Fix another layering violation in assmebly macro dumping 2018-03-06 16:51:17 +00:00
Object [WebAssebmly] Remove reloc ordering constraint 2018-03-06 07:13:10 +00:00
ObjectYAML [WebAssembly] Remove DataSize from linking metadata section 2018-02-27 23:57:37 +00:00
Option [Bash-autocompletion] Pass all flags in shell command-line to Clang 2018-03-05 08:54:20 +00:00
Passes Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
ProfileData [SampleProf] NFC. Expose reusable functionality in SampleProfile. 2018-02-22 06:42:57 +00:00
Support PrintStatistics() and PrintStatisticsJSON() should take StatLock 2018-03-06 21:16:42 +00:00
TableGen TableGen: Add !foldl operation 2018-03-06 13:49:16 +00:00
Target [TargetLowering] Rename DAGCombinerInfo::isAfterLegalizeVectorOps to DAGCombiner::isAfterLegalizeDAG since that's what it checks. NFC 2018-03-06 19:44:52 +00:00
Testing Force #define GTEST_LANG_CXX11. 2017-10-27 21:12:28 +00:00
ToolDrivers [COFF] Keep the underscore on exported decorated stdcall functions in MSVC mode 2018-01-20 11:44:32 +00:00
Transforms DA: remove uses of GEP, only ask SCEV 2018-03-06 21:55:59 +00:00
WindowsManifest Fix bug 34608 by moving private header out of public header. 2017-09-14 23:01:13 +00:00
XRay [XRay] clarify error messages when parsing broken traces 2018-01-30 13:41:34 +00:00
CMakeLists.txt Moving libFuzzer from LLVM to compiler-rt. 2017-08-21 23:25:12 +00:00
LLVMBuild.txt Re-apply "Introduce FuzzMutate library" 2017-08-21 22:57:06 +00:00