As reported in pr51656 scev-based salvaging can use excessive resources to the point of crashing when large SCEV expressions are encountered. This patch places a limit on the length of expression for which an attempt to translate will be made.
Details
Diff Detail
Unit Tests
Event Timeline
Looks like this didn't actually apply, the revision is showing this update as having applied no changes and the formatting issues are still present.
I also suppose it would be good if we could have the expression limit put as a variable with an explanatory comment, rather than a magic number. Other than that, this change LGTM.
Could the 64 be moved to a variable? Something similar to MaxIVUsers in the same file would be ideal - a static const variable at the top of the file with a comment explaining what it is used for.
Just a few nits inline. I otherwise defer to @StephenTozer's reviewing.
llvm/test/Transforms/LoopStrengthReduce/pr51656.ll | ||
---|---|---|
2 | Is there a reason for this test to be X86 specific? | |
79 | nit: I think the convention is to use a single ; for FileCheck directive comments. |
Two nits, other than that LGTM.
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | ||
---|---|---|
142 | ||
llvm/test/Transforms/LoopStrengthReduce/pr51656.ll | ||
78 | Just for the sake of resiliency, it would be better to replace the metadata references here with variable matches. So essentially replace !20 with ![[VAR_E:[0-9]+]], and then insert another check directive ![[VAR_E]] = !DILocalVariable(name: "e" below. |