[PATCH] D152456: SeparateConstOffsetFromGEP: Don't use SCEV

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 05:17:38 PDT 2023


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM

Nice to see that this also adds vector support as a side effect.



================
Comment at: llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp:1262
-      const SCEV *Key = SE->getAddExpr(
-          SE->getUnknown(LHS), SE->getNegativeSCEV(SE->getUnknown(RHS)));
-      DominatingSubs[Key].push_back(I);
----------------
arsenm wrote:
> Wasn't sure about trying to preserve this behavior. Seems like it would only fire for constant cases, where you would expect the extension of constant to fold to a larger constant which wasn't pattern matched before
This doesn't constant fold either due to use of SCEVUnknown. The reason for the getNegativeSCEV call here is to prevent the commutation behavior for subs. In your new implementation it's no longer needed.


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

https://reviews.llvm.org/D152456



More information about the llvm-commits mailing list