After investigation discussed in D45439, it would seem that the nsw flag restriction is unnecessary in most cases. So the IsInductionVar lambda has been removed, the functionality extracted, and now only require nsw when using eq/ne predicates.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
933 ↗ | (On Diff #142378) | How about non-constant steps? |
For me it looks fine, but please let me run some tests with this patch. I don't see obvious problem, and if they aren't revealed by this testing, I'll give my approval. It will take few hours.
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
933 ↗ | (On Diff #142378) | Never mind, it's checked above. Could have been a dyn_cast on line 923. |
test/Transforms/IRCE/stride_more_than_1.ll | ||
---|---|---|
221 ↗ | (On Diff #142378) | Will you please add a check that the postloop is generated? It looks like we should have one here, am I correct? |
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
923 ↗ | (On Diff #142378) | Please do affinity check first and take StepRecurrence only if it passes, it will save you some compile time on non-affine phis. Also can be dyn_cast. |
test/Transforms/IRCE/stride_more_than_1.ll | ||
---|---|---|
221 ↗ | (On Diff #142378) | sure. you're correct. |
llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
928 | Hi Sam, there is a bug here. dyn_cast may return nullptr and then we still access it, which is UB. I've fixed it in https://reviews.llvm.org/rL331508. Please review post-commit if you can. |
Hi Sam, there is a bug here. dyn_cast may return nullptr and then we still access it, which is UB. I've fixed it in https://reviews.llvm.org/rL331508. Please review post-commit if you can.