[PATCH] D121551: [InstCombine] Add general constant support to eq/ne icmp(add(X,C1),add(Y,C2)) -> icmp(add(X,C1-C2),Y) fold

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 13 15:30:24 PDT 2022


lebedev.ri added a comment.

I guess this looks good other than the constantexpr question.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4142
+      Value *NewAdd = Builder.CreateAdd(C, Diff);
+      return new ICmpInst(Pred, A, NewAdd);
+    }
----------------
Bikeshedding: is the phaseordering test affected similarly if you "swap" `A` and `C`,
in other words, do we have transforms elsewhere to move such computations out of loop body?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121551



More information about the llvm-commits mailing list