From 8308d47ddf720371bee36789b855c1d33a5f4080 Mon Sep 17 00:00:00 2001 From: Jesse Huang Date: Sun, 15 Sep 2024 23:15:14 +0800 Subject: [PATCH] [RISCV][MC] Set Ra for PseudoCALL in if-else clause --- llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp index 75323632dd5333..12ee6705fc4366 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp @@ -125,11 +125,12 @@ void RISCVMCCodeEmitter::expandFunctionCall(const MCInst &MI, MCRegister Ra; if (MI.getOpcode() == RISCV::PseudoTAIL) { Func = MI.getOperand(0); - Ra = RISCV::X6; // For Zicfilp, PseudoTAIL should be expanded to a software guarded branch. // It means to use t2(x7) as rs1 of JALR to expand PseudoTAIL. if (STI.hasFeature(RISCV::FeatureStdExtZicfilp)) Ra = RISCV::X7; + else + Ra = RISCV::X6; } else if (MI.getOpcode() == RISCV::PseudoCALLReg) { Func = MI.getOperand(1); Ra = MI.getOperand(0).getReg();