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

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 11:42:59 PDT 2023


goldstein.w.n 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);
----------------
nit: Builder.CreateBinOp(ShiftOp, ShiftedC2, AddC) -> constantexpr.


================
Comment at: llvm/test/Transforms/InstCombine/binop-of-displaced-shifts.ll:184
-; CHECK-NEXT:    [[SHIFT:%.*]] = shl <2 x i8> <i8 16, i8 32>, [[X]]
-; CHECK-NEXT:    [[ADD:%.*]] = add <2 x i8> [[X]], <i8 1, i8 2>
-; CHECK-NEXT:    [[SHIFT2:%.*]] = shl <2 x i8> <i8 3, i8 7>, [[ADD]]
----------------
maybe a negative test addc is non-splat and one element > bitwidth.


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

https://reviews.llvm.org/D152927



More information about the llvm-commits mailing list