[llvm] [RISCV] Handle zeroinitializer of vector tuple Type (PR #113995)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 18:34:18 PDT 2024


================
@@ -1900,6 +1900,13 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
                          DAG.getConstant(0, getCurSDLoc(), MVT::nxv16i1));
     }
 
+    if (VT.isRISCVVectorTuple()) {
+      assert(C->isNullValue() && "Can only zero this target type!");
+      return NodeMap[V] = DAG.getNode(
+                 ISD::SPLAT_VECTOR, getCurSDLoc(), VT,
+                 DAG.getConstant(0, getCurSDLoc(), MVT::getIntegerVT(8)));
----------------
topperc wrote:

You can create a normal SPLAT_VECTOR and bitcast it to the tuple type. In RISCVISelDAGToDAG:select, you can detect the (tupletype (bitcast (splat_vector 0))) and emit the correct number of instructions.

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


More information about the llvm-commits mailing list