================
@@ -24232,11 +24232,19 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
     if (!I)
       return V;
     // Drop nneg propagated from the original cast.
-    Value *Op;
     if (auto *CI = dyn_cast<CastInst>(VL0);
-        CI && match(I, m_NNegZExt(m_Value(Op))) &&
-        Op->getType()->getScalarType() != CI->getSrcTy())
-      cast<ZExtInst>(I)->setNonNeg(false);
+        CI && isa<PossiblyNonNegInst>(I) &&
+        I->getOperand(0)->getType()->getScalarType() !=
+            CI->getSrcTy()->getScalarType())
+      I->setNonNeg(false);
+    // A copyable zext lane is a zext of a truncated constant, which may be
+    // negative or undef.
----------------
MrSidims wrote:

Similar to 6359e4868465, this check prevents incorrect propagation of nneg. A 
copyable lane may introduce a constant that becomes negative after truncation, 
causing the vectorized zext nneg to produce poison.

https://github.com/llvm/llvm-project/pull/237240
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to