[LSR] Generalize one aspect of terminator folding (recently introduced in D132443)
authorPhilip Reames <preames@rivosinc.com>
Fri, 20 Jan 2023 20:15:44 +0000 (12:15 -0800)
committerPhilip Reames <listmail@philipreames.com>
Fri, 20 Jan 2023 20:19:43 +0000 (12:19 -0800)
commit7ad786a29e7bcd75bf3e7af2d96a0bf419faff64
tree39254ba59416a5299b025d7988968a61f4ac811f
parent1407dbeabcfed114f0918b022365d03713dac028
[LSR] Generalize one aspect of terminator folding (recently introduced in D132443)

There's no need to require the start value to come directly from the loop predecessor.  This was sometimes covering up a latent miscompile in this off-by-default option, but the miscompile needs fixed anyways and the issue has been raised on the original review.

Differential Revision: https://reviews.llvm.org/D142240
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold-negative-testcase.ll
llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold.ll