[PATCH] D132783: [InstCombine] add support for multi-use Y of (X op Y) op Z --> (Y op Z) op X

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 05:11:30 PDT 2022


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

I agree that this patch is taking the transform further into "-reassociate" territory, but I don't see a specific problem with the minor enhancement, so LGTM.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1758
+                      m_OneUse(m_Value(Z))))) {
     // (X op Y) op Z --> (Y op Z) op X
+    if (!isa<Constant>(X) && !isa<Constant>(Y) && !isa<Constant>(Z)) {
----------------
Move this comment line down, so it is above the corresponding code. 
Add another comment for:
  // (X op Y) opZ --> (X op Z) op Y


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132783



More information about the llvm-commits mailing list