[llvm] [SelectionDAG] Use promoted types when creating nodes after type legalization (PR #178617)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 30 02:08:09 PST 2026


================
@@ -3700,6 +3700,13 @@ bool TargetLowering::SimplifyDemandedVectorElts(
         SDLoc DL(Op);
         EVT SrcVT = Src.getValueType();
         EVT SrcSVT = SrcVT.getScalarType();
+
+        // If we're after type legalization and SrcSVT is not legal, use the
+        // promoted type for creating constants to avoid creating nodes with
+        // illegal types.
+        if (AfterLegalizeTypes)
+          SrcSVT = getLegalTypeToTransformTo(*TLO.DAG.getContext(), SrcSVT);
----------------
arsenm wrote:

The question is more why is there an illegal type here in the first place you would need to replace. There are 0 calls to getTypeToTransformTo or getLegalTypeToTransformTo in any of these other cases 

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


More information about the llvm-commits mailing list