forked from OSchip/llvm-project
3b9677e1ec
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. |
||
---|---|---|
.. | ||
Canonicalization.cpp | ||
CodePreparation.cpp | ||
DeLICM.cpp | ||
DeadCodeElimination.cpp | ||
FlattenAlgo.cpp | ||
FlattenSchedule.cpp | ||
ForwardOpTree.cpp | ||
MaximalStaticExpansion.cpp | ||
RewriteByReferenceParameters.cpp | ||
ScheduleOptimizer.cpp | ||
ScheduleTreeTransform.cpp | ||
ScopInliner.cpp | ||
Simplify.cpp | ||
ZoneAlgo.cpp |