[llvm] [CodeGen] This patch fix a bug that may caused error for a self-defined target in SelectionDAG::getNode (PR #75320)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 21:01:58 PST 2023


================
@@ -6858,8 +6858,9 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
     // expanding copies of large vectors from registers. This only works for
     // fixed length vectors, since we need to know the exact number of
     // elements.
-    if (N2C && N1.getOperand(0).getValueType().isFixedLengthVector() &&
----------------
topperc wrote:

Can we do

```
if (N2C && N1.getOpcode() == ISD::CONCAT_VECTORS &&
    N1.getOperand(0).getValueType().isFixedLengthVector())
```

I don't think we need the `N1.getNumOperands() > 0`. A CONCAT_VECTORS should never be created with no operands. It would fail an assert in `foldCONCAT_VECTORS` if we tried to create it.

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


More information about the llvm-commits mailing list