[llvm] [DAG] canCreateUndefOrPoison/isGuaranteedNotToBeUndefOrPoison - SCALAR_TO_VECTOR upper elements are poison (PR #217185)

Björn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 00:36:48 PDT 2026


================
@@ -3352,11 +3352,9 @@ bool TargetLowering::SimplifyDemandedVectorElts(
 
   switch (Opcode) {
   case ISD::SCALAR_TO_VECTOR: {
-    if (!DemandedElts[0]) {
-      KnownUndef.setAllBits();
-      return TLO.CombineTo(Op, TLO.DAG.getUNDEF(VT));
-    }
-    KnownUndef.setHighBits(NumElts - 1);
+    if (!DemandedElts[0])
+      return TLO.CombineTo(Op, TLO.DAG.getPOISON(VT));
+    // Upper elements are poison, not undef - don't mark them as KnownUndef.
----------------
bjope wrote:

If they are poison, then they are also undef. So I suggest removing the ", not undef" part.

But it is also unclear what the reasoning is here. Why shouldn't we mark them as KnownUndef?

https://github.com/llvm/llvm-project/pull/217185


More information about the llvm-commits mailing list