[PATCH] D51900: [InstCombine] Support (mul (sext x), cst) --> (sext (mul x, cst')) and (mul (zext x), cst) --> (zext (mul x, cst')) for vectors constants.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 11 06:37:14 PDT 2018


spatel added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:328-332
   if (SExtInst *Op0Conv = dyn_cast<SExtInst>(Op0)) {
     // (mul (sext x), cst) --> (sext (mul x, cst'))
-    if (ConstantInt *Op1C = dyn_cast<ConstantInt>(Op1)) {
+    Constant *Op1C;
+    if (match(Op1, m_Constant(Op1C))) {
       if (Op0Conv->hasOneUse()) {
----------------
Nit: here and below, it would probably be easier to read and shorter using 'match' rather than dyn_cast.


https://reviews.llvm.org/D51900





More information about the llvm-commits mailing list