[PATCH] D118808: Loop Strength Reduce - Optimize unused IVs to final values in the exit block with SCEV

Zaara Syeda via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 11:40:20 PST 2022


syzaara added a comment.

In D118808#3365997 <https://reviews.llvm.org/D118808#3365997>, @Whitney wrote:

>> IndVarSimply calls rewriteLoopExitValues from LoopUtils to do this optimization. I tried to call the same function in LoopStrengthReduce, however rewriteLoopExitValues asserts that it requires: L->isRecursivelyLCSSAForm(*DT, *LI).
>
> When calling rewriteLoopExitValues from LoopStrengthReduce, this assert is not met.
>
> I am confused, is the assert from rewriteLoopExitValues met or not when calling from LoopStrengthReduce?  Does LoopStrengthReduce currently rely on LCSSA form? Is it only become not LCSSA after LoopStrengthReduce changes the code?
> Can we first invoke formLCSSA to form LCSSA before calling rewriteLoopExitValues?

There were cases in lit and lnt where we would fail due to this assert. I have modified the patch to use rewriteLoopExitValues if the loop returns true for isRecursivelyLCSSAForm where there is only one use of the exit value aside from the use in the exit phi.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118808/new/

https://reviews.llvm.org/D118808



More information about the llvm-commits mailing list