This patch enables recognition of loops with ult/ugt latch conditions.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
| lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
|---|---|---|
| 1020 ↗ | (On Diff #106189) | 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 ↗ | (On Diff #106189) | |
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 ↗ | (On Diff #106395) | Pls rename this as isSignedPredicate. |
| 846 ↗ | (On Diff #106395) | Pls name this as the PredOpCode. I got confused with guards.. |
| 978 ↗ | (On Diff #106395) | This to isSignedPredicate as well. Similarly for all other booleans. |
| lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
|---|---|---|
| 846 ↗ | (On Diff #106395) | 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 ↗ | (On Diff #109068) | Nit: set to nullptr. |
| 1248 ↗ | (On Diff #109068) | 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 | ||
|---|---|---|
| 1213 ↗ | (On Diff #109512) | Set to nullptr here as well. |