This patch enables recognition of loops with ult/ugt latch conditions.
Details
Diff Detail
Event Timeline
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
1020 | This is actually a bug that also exists for start = SINT_MAX even without this patch. I'm going to fix it separately. |
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
1020 |
Couple of minor changes. I haven't looked at the tests yet.
Do you mind separating out the ULT/ULE changes from the UGT/UGE just for ease of reviewing? Once the first part is reviewed, the second would be pretty straightforward.
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
462 | Pls rename this as isSignedPredicate. | |
846 | Pls name this as the PredOpCode. I got confused with guards.. | |
978 | This to isSignedPredicate as well. Similarly for all other booleans. |
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
846 | Renamed to BoundPred to avoid confusion. Semantically it is a predicate we need to check to make sure that the indvar lies within bounds. |
Looks almost ready to go. Some comments regarding additional tests.
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
1218–1226 | Nit: set to nullptr. | |
1238–1246 | set to nullptr. | |
test/Transforms/IRCE/unsigned_comparisons_ugt.ll | ||
9 ↗ | (On Diff #109068) | Please add some tests or checks for post loops as well. That code's not tested here. |
test/Transforms/IRCE/unsigned_comparisons_ult.ll | ||
10 ↗ | (On Diff #109068) | Please add some tests or checks for post loops as well. That code's not tested here. |
Addressed nits, reworked tests so that now they check the structure of transformed loop, not only the fact that the transformation has happened.
test/Transforms/IRCE/eq_ne.ll | ||
---|---|---|
18 ↗ | (On Diff #109512) | Also need to update the tests in the same manner for this file. I will do it later in a separate patch. |
LGTM.
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
1203–1211 | Set to nullptr here as well. |
Pls rename this as isSignedPredicate.