[llvm] [BOLT] Delete unnecessary instructions (PR #189297)

Kito Cheng via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 06:44:30 PDT 2026


================
@@ -553,15 +553,12 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
                .addReg(RegCnt);
   }
 
-  InstructionListType createRegCmpJE(MCPhysReg RegNo, MCPhysReg RegTmp,
-                                     const MCSymbol *Target,
+  InstructionListType createRegCmpJE(MCPhysReg RegNo, const MCSymbol *Target,
                                      MCContext *Ctx) const {
     InstructionListType Insts;
-    Insts.emplace_back(
-        MCInstBuilder(RISCV::SUB).addReg(RegTmp).addReg(RegNo).addReg(RegNo));
     Insts.emplace_back(MCInstBuilder(RISCV::BEQ)
                            .addReg(RegNo)
-                           .addReg(RegTmp)
+                           .addReg(RISCV::X0)
----------------
kito-cheng wrote:

X0 is constant zero for RISC-V like MIPS, so it's OK to use hard code reg here IMO 

https://github.com/llvm/llvm-project/pull/189297


More information about the llvm-commits mailing list