================
@@ -25641,6 +25641,12 @@ static SDValue performUzpCombine(SDNode *N, 
SelectionDAG &DAG,
   SDValue Op1 = N->getOperand(1);
   EVT ResVT = N->getValueType(0);
 
+  // UZP is used to lower insert_subvector quite early. When later DAG combines
+  // run, it's possible to actually end up with an insert of UNDEF into UNDEF,
+  // i.e. UZP1 UNDEF, UNDEF.
+  if (Op0.isUndef() && Op1.isUndef())
+    return DAG.getUNDEF(ResVT);
----------------
gbossu wrote:

This is the "nicest" change I could come up with to simplify the codegen issue 
with illegal gathers. See 
https://github.com/llvm/llvm-project/pull/204620#discussion_r3437035793.

Alternatives would be:
* In `WidenVecRes_MGATHER`, do not widen all the way to the requested type if 
that means creating an illegal type for the indices. I don't like this because 
I think we should listen to `TLI.getTypeToTransformTo()`
* In `SplitVecRes_Gather`, do not even create the hi part of the gather if all 
its indices are undef. This works out of the box, but I'd rather look at the 
mask operand than the indices.
* In `SplitVecRes_Gather`, do not even create the hi part of the gather if its 
mask is all false. This is cleaner, but `ISD::isConstantSplatVectorAllZeros` 
isn't able to find that the mask is false because it does not look through 
`extract_vector(concat_vectors ...)`.

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

Reply via email to