[PATCH] D141481: [SCEV] Canonicalize ext(min/max(x, y)) to min/max(ext(x), ext(y))

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 04:39:52 PST 2023


mkazantsev updated this revision to Diff 494588.
mkazantsev added a comment.

Rebased and updated.

Short summary:

1. With improvements in SCEVLoopGuardRewriter, all old regressions are fixed.
2. I've added a bunch of new tests and two of them start working with D143259 <https://reviews.llvm.org/D143259> but regress with this canonicalization back to the prior state. I don't know why exactly.
3. The whole thing with divisibility is raw and fragile, and this fragility is spiralling out of scope, this time the problem seems to be in SCEVLoopGuardRewriter.
4. Rather than doing all these crazy rewritings, I'd just prefer to have `getRangeAtScope` and it seems to solve all problems we've faced so far.

I'll try to find some time to take a look into it later myself or ask someone of my colleagues to investigate, but I absolutely don't want to be blocked on these new tests. They never worked, they don't work again, this is fine.


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

https://reviews.llvm.org/D141481

Files:
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/test/Analysis/ScalarEvolution/ext_min_max.ll
  llvm/test/Analysis/ScalarEvolution/fold.ll
  llvm/test/Analysis/ScalarEvolution/logical-operations.ll
  llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll
  llvm/test/Analysis/ScalarEvolution/ptrtoint.ll
  llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141481.494588.patch
Type: text/x-patch
Size: 28643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230203/6ec6b18d/attachment.bin>


More information about the llvm-commits mailing list