llvm-project/polly/lib
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
..
Analysis [Polly] Track defined behavior for PHI predecessor computation. 2021-01-23 13:03:49 -06:00
CodeGen [Polly][CodeGen] Remove use of ScalarEvolution. 2020-12-07 15:21:51 -06:00
Exchange [Polly] Silence mixed signed/unsigned comparison warnings. NFC. 2020-02-10 19:03:08 -06:00
External [Polly] Update isl to isl-0.23-61-g24e8cd12. 2021-01-19 12:01:31 -06:00
Plugin Generalize the pass registration mechanism used by Polly to any third-party tool 2020-01-02 16:45:31 +01:00
Support [Polly] Track defined behavior for PHI predecessor computation. 2021-01-23 13:03:49 -06:00
Transform [Polly] Track defined behavior for PHI predecessor computation. 2021-01-23 13:03:49 -06:00
CMakeLists.txt [Windows][Polly] Disable LLVMPolly module for all compilers on Windows 2020-09-15 09:12:38 +03:00