diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -7938,6 +7938,7 @@ RetOps.push_back(Glue); } + unsigned RetOpc = RISCVISD::RET_FLAG; // Interrupt service routines use different return instructions. const Function &Func = DAG.getMachineFunction().getFunction(); if (Func.hasFnAttribute("interrupt")) { @@ -7949,18 +7950,15 @@ 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(