[PATCH] D76800: [InstCombine] Fix Incorrect fold of ashr+xor -> lshr w/ vectors

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 25 15:11:28 PDT 2020


lebedev.ri added a comment.

In D76800#1942223 <https://reviews.llvm.org/D76800#1942223>, @spatel wrote:

> static inline Constant *getSafeVectorConstantForBinop()


Yes, i think that's the one.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:3072
     if (match(NotVal, m_AShr(m_Constant(C), m_Value(Y))) &&
-        match(C, m_Negative()))
+        match(C, m_Negative()) &&
+        (!C->getType()->isVectorTy() || !C->containsUndefElement()))
----------------
RKSimon wrote:
> m_Negative uses cst_pred_ty internally which just continues if it finds an undef in a vector - maybe we don't want that?
> 
We only need to handle undefs correctly, we don't need to completely give up on them here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76800





More information about the llvm-commits mailing list