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

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 06:40:30 PDT 2022


RKSimon added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4142
+      Value *NewAdd = Builder.CreateAdd(C, Diff);
+      return new ICmpInst(Pred, A, NewAdd);
+    }
----------------
lebedev.ri wrote:
> 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?
It makes no difference - I checked if we could handle this by using the oneuse binop but that had on effect either.


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