This patch enables recognition of loops with ult/ugt latch conditions.
Details
Diff Detail
Event Timeline
| lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
|---|---|---|
| 1039 | 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 | ||
|---|---|---|
| 1039 | ||
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. | |
| 853 | Pls name this as the PredOpCode. I got confused with guards.. | |
| 993 | This to isSignedPredicate as well. Similarly for all other booleans. | |
| lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
|---|---|---|
| 853 | 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 | ||
|---|---|---|
| 1228–1236 | Nit: set to nullptr. | |
| 1248–1256 | set to nullptr. | |
| test/Transforms/IRCE/unsigned_comparisons_ugt.ll | ||
| 10 | Please add some tests or checks for post loops as well. That code's not tested here. | |
| test/Transforms/IRCE/unsigned_comparisons_ult.ll | ||
| 11 | 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 | 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 | ||
|---|---|---|
| 1213 | Set to nullptr here as well. | |
Pls rename this as isSignedPredicate.