llvm-project/polly
Michael Kruse 3b9677e1ec [Polly] Track defined behavior for PHI predecessor computation.
ZoneAlgorithms's computePHI relies on being provided with consistent a
schedule to compute the statement prodecessors of a statement containing
PHINodes. Otherwise unexpected results such as PHI nodes with multiple
predecessors can occur which would result in problems in the
algorithms expecting consistent data.

In the added test case, statement instances are scrubbed from the
SCoP their execution would result in undefined behavior (Due to a nsw
overflow). As already being undefined behavior in LLVM-IR, neither
AssumedContext nor InvalidContext are updated, giving computePHI no
means to avoid these cases.

Intoduce a new SCoP property, the DefinedBehaviorContext, that among
the runtime-checked conditions, also tracks the assumptions not needing
a runtime check, in particular those affecting the assumed control flow.
This replaces the manual combination of the 3 other contexts that was
already done in computePHI and setNewAccessRelation. Currently, the only
additional assumption is that loop induction variables will nsw flag for
not wrap, but potentially more can be added. Use in
hasFeasibleRuntimeContext, isl::ast_build and gisting are other
potential uses.

To limit computational complexity, the DefinedBehaviorContext is not
availabe if it grows too large (atm hardcoded to 8 disjuncts).

Possible other fixes include bailing out in computePHI when
inconsistencies are detected, choose an arbitrary value for inconsistent
cases (since it is undefined behavior anyways), or make the code
receiving the result from ComputePHI handle inconsistent data. All of
them reduce the quality of implementation having to bail out more often
and disabling the ability to assert on actually wrong results.

This fixes llvm.org/PR48783.
2021-01-23 13:03:49 -06:00
..
cmake [Windows][Polly] Disable LLVMPolly module for all compilers on Windows 2020-09-15 09:12:38 +03:00
docs Bump the trunk major version to 12 2020-07-15 12:05:05 +02:00
include/polly [Polly] Track defined behavior for PHI predecessor computation. 2021-01-23 13:03:49 -06:00
lib [Polly] Track defined behavior for PHI predecessor computation. 2021-01-23 13:03:49 -06:00
test [Polly] Track defined behavior for PHI predecessor computation. 2021-01-23 13:03:49 -06:00
tools Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
unittests [Polly] Support linking ScopPassManager against LLVM dylib 2020-08-07 06:46:35 +02:00
utils Harmonize Python shebang 2020-07-16 21:53:45 +02:00
www [BasicAA] Replace -basicaa with -basic-aa in polly 2020-06-30 15:50:17 -07:00
.arclint
.gitattributes
.gitignore
CMakeLists.txt Remove .svn from exclude list as we moved to git 2020-10-21 16:09:21 +02:00
CREDITS.txt
LICENSE.txt Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
README

README

Polly - Polyhedral optimizations for LLVM
-----------------------------------------
http://polly.llvm.org/

Polly uses a mathematical representation, the polyhedral model, to represent and
transform loops and other control flow structures. Using an abstract
representation it is possible to reason about transformations in a more general
way and to use highly optimized linear programming libraries to figure out the
optimal loop structure. These transformations can be used to do constant
propagation through arrays, remove dead loop iterations, optimize loops for
cache locality, optimize arrays, apply advanced automatic parallelization, drive
vectorization, or they can be used to do software pipelining.