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

Cyrus Ding via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 27 18:30:20 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.
----------------
dingcyrus wrote:

Thanks Simon — followed #226124 over to #226003: I'm folding the `ISD::UNDEF` guard and the PowerPC test updates from your exploration into that PR (commit 3), so the draft can be closed if you prefer. Björn's header-doc point is covered there too (commit 2).

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


More information about the llvm-commits mailing list