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

Alexey Moksyakov via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 05:52:58 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)
----------------
yavtuk wrote:

do you really want to use hardcoded register here?

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


More information about the llvm-commits mailing list