[PATCH] D152278: [SCEV] Compute SCEV for ashr(add(shl(x, n), c), m) instr triplet

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 00:44:51 PDT 2023


nikic added a comment.

I assume the motivation for this is the following InstCombine transform? https://llvm.godbolt.org/z/zd63TWKbW I don't think we can change that canonicalization, so undoing it in SCEV is fine.



================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:7911
+
       if (L && L->getOpcode() == Instruction::Shl) {
         // X = Shl A, n
----------------
We already have code to handle the general shl+ashr pattern here, including for the case where n and m are not the same. We should reuse the same code. For your pattern, we'd just have an extra add at the start.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152278



More information about the llvm-commits mailing list