[PATCH] D71568: [InstCombine] `select + mul` -> `select + shl` with power of twos.

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 30 08:04:00 PST 2019


xbolva00 added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:298
+  if (!match(ShiftLeft, m_Shl(m_Constant(CI), m_Value(N))))
+    llvm_unreachable("match should never fail here!");
+  Constant *Log2Base = getLogBase2(N->getType(), CI);
----------------
Dtto


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:300
+  Constant *Log2Base = getLogBase2(N->getType(), CI);
+  if (!Log2Base)
+    llvm_unreachable("getLogBase2 should never fail here!");
----------------
assert is better choice here?


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:324
+  if (match(Op1, m_Power2())) {
+    Actions.push_back(OperandFoldAction(foldMulPow2Cst, Op1));
+    return Actions.size();
----------------
emplace_back?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71568





More information about the llvm-commits mailing list