Index: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp =================================================================== --- llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp +++ llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp @@ -2127,7 +2127,7 @@ } // Update the chain. - ReplaceUses(Src.getValue(1), SDValue(Load, 1)); + ReplaceUses(Src.getValue(Ld->isIndexed() ? 2 : 1), SDValue(Load, 1)); // Record the mem-refs CurDAG->setNodeMemRefs(Load, {Ld->getMemOperand()}); // Replace the splat with the vlse.