[llvm] de7fa3a - [RISCV] Copy memoperands in some of the post isel peepholes.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 2 09:24:38 PDT 2023
Author: Craig Topper
Date: 2023-08-02T09:16:14-07:00
New Revision: de7fa3ab9a4ed05e7e4ef05b0919db52383969c5
URL: https://github.com/llvm/llvm-project/commit/de7fa3ab9a4ed05e7e4ef05b0919db52383969c5
DIFF: https://github.com/llvm/llvm-project/commit/de7fa3ab9a4ed05e7e4ef05b0919db52383969c5.diff
LOG: [RISCV] Copy memoperands in some of the post isel peepholes.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D156830
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
index 9be755c9d68631..1b077712794636 100644
--- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
@@ -142,7 +142,7 @@ void RISCVDAGToDAGISel::PostprocessISelDAG() {
continue;
MadeChange |= doPeepholeSExtW(N);
- MadeChange |= doPeepholeMaskedRVV(N);
+ MadeChange |= doPeepholeMaskedRVV(cast<MachineSDNode>(N));
}
CurDAG->setRoot(Dummy.getValue());
@@ -3205,7 +3205,7 @@ static bool isImplicitDef(SDValue V) {
// corresponding "unmasked" pseudo versions. The mask we're interested in will
// take the form of a V0 physical register operand, with a glued
// register-setting instruction.
-bool RISCVDAGToDAGISel::doPeepholeMaskedRVV(SDNode *N) {
+bool RISCVDAGToDAGISel::doPeepholeMaskedRVV(MachineSDNode *N) {
const RISCV::RISCVMaskedPseudoInfo *I =
RISCV::getMaskedPseudoInfo(N->getMachineOpcode());
if (!I)
@@ -3244,7 +3244,12 @@ bool RISCVDAGToDAGISel::doPeepholeMaskedRVV(SDNode *N) {
if (auto *TGlued = Glued->getGluedNode())
Ops.push_back(SDValue(TGlued, TGlued->getNumValues() - 1));
- SDNode *Result = CurDAG->getMachineNode(Opc, SDLoc(N), N->getVTList(), Ops);
+ MachineSDNode *Result =
+ CurDAG->getMachineNode(Opc, SDLoc(N), N->getVTList(), Ops);
+
+ if (!N->memoperands_empty())
+ CurDAG->setNodeMemRefs(Result, N->memoperands());
+
Result->setFlags(N->getFlags());
ReplaceUses(N, Result);
@@ -3514,10 +3519,13 @@ bool RISCVDAGToDAGISel::performCombineVMergeAndVOps(SDNode *N) {
// Add the glue for the CopyToReg of mask->v0.
Ops.push_back(Glue);
- SDNode *Result =
+ MachineSDNode *Result =
CurDAG->getMachineNode(MaskedOpc, DL, True->getVTList(), Ops);
Result->setFlags(True->getFlags());
+ if (!cast<MachineSDNode>(True)->memoperands_empty())
+ CurDAG->setNodeMemRefs(Result, cast<MachineSDNode>(True)->memoperands());
+
// Replace vmerge.vvm node by Result.
ReplaceUses(SDValue(N, 0), SDValue(Result, 0));
diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
index d7ee20eb4eedc1..a2e5c50c370c27 100644
--- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
+++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
@@ -185,7 +185,7 @@ class RISCVDAGToDAGISel : public SelectionDAGISel {
private:
bool doPeepholeSExtW(SDNode *Node);
- bool doPeepholeMaskedRVV(SDNode *Node);
+ bool doPeepholeMaskedRVV(MachineSDNode *Node);
bool doPeepholeMergeVVMFold();
bool performVMergeToVMv(SDNode *N);
bool performCombineVMergeAndVOps(SDNode *N);
More information about the llvm-commits
mailing list