[llvm] 779d2b0 - [RISCV][NFC] Combine the control flow for different RetOp of interrupt function
Jim Lin via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 26 02:25:16 PDT 2021
Author: Jim Lin
Date: 2021-06-26T17:28:03+08:00
New Revision: 779d2b0a427316e9f425b0854ed4465791a4d98c
URL: https://github.com/llvm/llvm-project/commit/779d2b0a427316e9f425b0854ed4465791a4d98c
DIFF: https://github.com/llvm/llvm-project/commit/779d2b0a427316e9f425b0854ed4465791a4d98c.diff
LOG: [RISCV][NFC] Combine the control flow for different RetOp of interrupt function
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D104838
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 7f9d0cf4637d..3cf3ad958f69 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -8029,6 +8029,7 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
RetOps.push_back(Glue);
}
+ unsigned RetOpc = RISCVISD::RET_FLAG;
// Interrupt service routines use
diff erent return instructions.
const Function &Func = DAG.getMachineFunction().getFunction();
if (Func.hasFnAttribute("interrupt")) {
@@ -8040,18 +8041,15 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
StringRef Kind =
MF.getFunction().getFnAttribute("interrupt").getValueAsString();
- unsigned RetOpc;
if (Kind == "user")
RetOpc = RISCVISD::URET_FLAG;
else if (Kind == "supervisor")
RetOpc = RISCVISD::SRET_FLAG;
else
RetOpc = RISCVISD::MRET_FLAG;
-
- return DAG.getNode(RetOpc, DL, MVT::Other, RetOps);
}
- return DAG.getNode(RISCVISD::RET_FLAG, DL, MVT::Other, RetOps);
+ return DAG.getNode(RetOpc, DL, MVT::Other, RetOps);
}
void RISCVTargetLowering::validateCCReservedRegs(
More information about the llvm-commits
mailing list