[llvm] [RISCV][GlobalIsel] Reduce constant pool usage without FP extension (PR #158346)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 12 12:15:02 PDT 2025


================
@@ -745,10 +745,19 @@ bool RISCVInstructionSelector::select(MachineInstr &MI) {
       if (!materializeImm(GPRReg, Imm.getSExtValue(), MIB))
         return false;
 
-      unsigned Opcode = Size == 64   ? RISCV::FMV_D_X
-                        : Size == 32 ? RISCV::FMV_W_X
-                                     : RISCV::FMV_H_X;
-      auto FMV = MIB.buildInstr(Opcode, {DstReg}, {GPRReg});
+      unsigned Opcode = RISCV::INIT_UNDEF;
----------------
topperc wrote:

This doesn't need to live at this scope. Just declare it in the blocks that it is used.

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


More information about the llvm-commits mailing list