[PATCH] D132996: [InstCombine] complete fold extractvalue (any_mul_with_overflow X, -1)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 13:50:53 PDT 2022


spatel added a comment.

Does this confirm with Alive2? (add link to patch summary)



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3254
   Intrinsic::ID OvID = WO->getIntrinsicID();
-  if (*EV.idx_begin() == 0 &&
-      (OvID == Intrinsic::smul_with_overflow ||
-       OvID == Intrinsic::umul_with_overflow) &&
-      match(WO->getArgOperand(1), m_AllOnes())) {
-    return BinaryOperator::CreateNeg(WO->getArgOperand(0));
+  const APInt *WORHSC = nullptr;
+  if (match(WO->getRHS(), m_APIntAllowUndef(WORHSC))) {
----------------
Nit: that's a lot of capital letters. Just leave this named "C"?


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3290
   // checking for overflow.
-  const APInt *C;
-  if (match(WO->getRHS(), m_APInt(C))) {
+  if (WORHSC) {
     // Compute the no-wrap range for LHS given RHS=C, then construct an
----------------
We need a test for this transform too? (and confirm that it is safe)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132996



More information about the llvm-commits mailing list