This optimization finds loop exit values reevaluated after the loop execution and replaces them by the corresponding exit values if they are available. Such sequences can arise after the SimplifyIndVals+LoopStrengthReduce passes. This pass should be run after LoopStrengthReduce.
Details
- Reviewers
- None
Diff Detail
Event Timeline
lib/CodeGen/Passes.cpp | ||
---|---|---|
411 | Fix indenting. | |
lib/Transforms/Scalar/LoopExitValues.cpp | ||
1 | Stale header comment. | |
149 | not -> ! [to match our general conventions] | |
154 | You should do the type-based validity checking prior to calling DT.dominates (which is going to be significantly more expensive). Also, when do the types not match? Can getSCEVAtScope return an SCEV with a different type than its argument? |
Hi Steve,
I wonder if it might be related to PR24920 (and D12765). Out of curiosity, could you check what happens in your testcase with the patch from there applied?
Also, some comments inline:
Thanks,
Michael
lib/Transforms/Scalar/LoopExitValues.cpp | ||
---|---|---|
32 | s/is/in/ | |
135 | This resembles what SCEVExpander does (particularly, findExistingExpansion function). Would it be possible/beneficial to just reuse it here somehow? | |
test/Transforms/LoopExitValues/matrix_mul.ll | ||
1–2 | It probably needs ; REQUIRES: Asserts |
Any particular reason this was never followed through? This pass might solve https://bugs.llvm.org/show_bug.cgi?id=42965 .
Fix indenting.