[llvm] [DAGCombiner][NVPTX] Avoid forming illegal-typed shuffles after type-legalization (PR #205056)

Srinivasa Ravi via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 03:14:06 PDT 2026


================
@@ -24638,10 +24638,12 @@ SDValue DAGCombiner::combineInsertEltToShuffle(SDNode *N, unsigned InsIndex) {
       Mask[i] = i;
   }
 
-  // Bail out if the target can not handle the shuffle we want to create.
+  // Bail out if the target can not handle the shuffle we want to create, or
+  // would create an illegal-typed shuffle after type legalization.
   EVT SubVecEltVT = SubVecVT.getVectorElementType();
   EVT ShufVT = EVT::getVectorVT(*DAG.getContext(), SubVecEltVT, NumMaskVals);
-  if (!TLI.isShuffleMaskLegal(Mask, ShufVT))
+  if (!TLI.isShuffleMaskLegal(Mask, ShufVT) ||
+      (LegalTypes && !TLI.isTypeLegal(ShufVT)))
----------------
Wolfram70 wrote:

Thanks for taking a look! Just to make I'm understanding this correctly, are you asking whether I plan to replicate this `isTypeLegal` check at the other `isShuffleMaskLegal` call sites too? I only added it here since this is the call site that formed the illegal-typed shuffle post-type-legalization.

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


More information about the llvm-commits mailing list