[PATCH] D148210: [InstCombine] Reassociate (C * X) * Y in foldICmpMulConstant

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 14:34:47 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:2071
+      if (Value *NewMul =
+              Reassociate(X, Y, ConstantInt::get(Mul->getType(), C->shl(*C))))
+        return NewMul;
----------------
1 << C, not C << C?


================
Comment at: llvm/test/Transforms/InstCombine/icmp.ll:5345
+; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i8> [[TMP1]], <i8 -1, i8 -1>
 ; CHECK-NEXT:    ret <2 x i1> [[CMP]]
 ;
----------------
Add some tests for the `shl` case. Better yet split adding the `shl` logic to a follow up patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148210



More information about the llvm-commits mailing list