[llvm] Port `NVPTXTargetLowering::LowerCONCAT_VECTORS` to SelectionDAG (PR #120030)

Ethan Kaji via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 16:05:45 PST 2024


================
@@ -1524,11 +1524,14 @@ SDValue SelectionDAGLegalize::ExpandConcatVectors(SDNode *Node) {
   SmallVector<SDValue, 16> Ops;
   unsigned NumOperands = Node->getNumOperands();
   MVT VectorIdxType = TLI.getVectorIdxTy(DAG.getDataLayout());
+  EVT VectorValueType = Node->getOperand(0).getValueType();
+  EVT ElementValueType = VectorValueType.getVectorElementType();
+  if (ElementValueType !=
+      TLI.getTypeToTransformTo(*DAG.getContext(), ElementValueType)) {
----------------
Esan5 wrote:

This is similar to what justinfargnoli suggested, but I believe the extract_vector_elt operation is legal for the particular test case that is worse. Even when I made the check:

```  
  if (!TLI.isOperationLegal(ISD::EXTRACT_VECTOR_ELT, ElementValueType)) {
      return ExpandVectorBuildThroughStack(Node);
  }
```

I didn't see a change, so it seems like just checking the action associated with the operation is not sufficient.

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


More information about the llvm-commits mailing list