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();