[PATCH] D151796: [SCEV] Skip min/max expressions when normalizing/denormalizing SCEV expressions

Dmitry Makogon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 19 04:23:20 PDT 2023


dmakogon added inline comments.


================
Comment at: llvm/test/Transforms/LoopStrengthReduce/pr62563.ll:6
 
-; XFAIL: *
-
----------------
nikic wrote:
> Please precommit this change. This test should be showing a difference in generated IR.
Unfortunately, miscompilation on this test is not reproducible after 6ed152aff4aa. Before that patch, SCEV didn't initially simplify the expression it returned after normalization to just the AddRec (however it could). And denormalizing it back would return the initial expression and the bail out you mentioned in another comment here wouldn't work.
Simplification actually did happen later in LSR and it lead to illegal transform.
With that patch applied, SCEV performs the simplification during normalization due to more precise ranges available for the expression, and then the bail out works and normalized expression is discarded.

I couldn't come up with another IR test, but I think the issue can still happen if some simplifications won't apply right after normalization and the bail out won't work.


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

https://reviews.llvm.org/D151796



More information about the llvm-commits mailing list