[PATCH] D152927: [InstCombine] Fold binop of shifts with related amounts

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 02:14:52 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2151
+  Value *NewC = Builder.CreateBinOp(
+      I.getOpcode(), ShiftedC1, Builder.CreateBinOp(ShiftOp, ShiftedC2, AddC));
+  return Builder.CreateBinOp(ShiftOp, NewC, ShAmt);
----------------
goldstein.w.n wrote:
> nit: Builder.CreateBinOp(ShiftOp, ShiftedC2, AddC) -> constantexpr.
IRBuilder is preferred unless the `Constant *` type is required. It will work transparently when shift constant expressions are removed.


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

https://reviews.llvm.org/D152927



More information about the llvm-commits mailing list