[PATCH] D51236: [InstCombine] Extend (add (sext x), cst) --> (sext (add x, cst')) and (add (zext x), cst) --> (zext (add x, cst')) to work for vectors

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 25 08:13:25 PDT 2018


spatel added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1199
+    Constant *RHSC;
+    if (match(RHS, m_ConstantIntOrConstantIntVec(RHSC))) {
       if (LHSConv->hasOneUse()) {
----------------
I don't understand what benefit the new pattern matcher offers. We're already guaranteed that the constant is (vector) integer type because this is an 'add'. Do we need to disallow constant expressions? If not, use the existing m_Constant() matcher?


https://reviews.llvm.org/D51236





More information about the llvm-commits mailing list