[llvm] 9e0f9f1 - [RISCV] Preserve chain output when selecting splat as x0 strided load.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 18:10:28 PST 2022


Author: Craig Topper
Date: 2022-11-29T18:09:55-08:00
New Revision: 9e0f9f113248093e737c4cf5450f0a3c2bcd90ba

URL: https://github.com/llvm/llvm-project/commit/9e0f9f113248093e737c4cf5450f0a3c2bcd90ba
DIFF: https://github.com/llvm/llvm-project/commit/9e0f9f113248093e737c4cf5450f0a3c2bcd90ba.diff

LOG: [RISCV] Preserve chain output when selecting splat as x0 strided load.

We need the vlse node to have a chain output and it should replace
the chain output of the original load.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
index 3f83f8933fd3..274c94ab2947 100644
--- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
@@ -1834,10 +1834,12 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
         /*IsMasked*/ false, /*IsTU*/ false, /*IsStrided*/ true, /*FF*/ false,
         Log2SEW, static_cast<unsigned>(LMUL));
     MachineSDNode *Load =
-        CurDAG->getMachineNode(P->Pseudo, DL, Node->getVTList(), Operands);
-
+        CurDAG->getMachineNode(P->Pseudo, DL, {VT, MVT::Other}, Operands);
+    // Update the chain.
+    ReplaceUses(Src.getValue(1), SDValue(Load, 1));
+    // Record the mem-refs
     CurDAG->setNodeMemRefs(Load, {Ld->getMemOperand()});
-
+    // Replace the splat with the vlse.
     ReplaceNode(Node, Load);
     return;
   }


        


More information about the llvm-commits mailing list