[llvm] [RISCV] Remove an unnecessary cast (NFC) (PR #156600)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 23:55:01 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/156600

*MF is already non const.


>From 5eba789087831f03e10a7f321985c6a630b4235f Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 2 Sep 2025 23:35:56 -0700
Subject: [PATCH] [RISCV] Remove an unnecessary cast (NFC)

*MF is already non const.
---
 llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp b/llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp
index 51ea3fc5f6774..7df1b7e580002 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp
@@ -1158,8 +1158,8 @@ bool RISCVInstructionSelector::selectAddr(MachineInstr &MI,
 
   switch (TM.getCodeModel()) {
   default: {
-    reportGISelFailure(const_cast<MachineFunction &>(*MF), *TPC, *MORE,
-                       getName(), "Unsupported code model for lowering", MI);
+    reportGISelFailure(*MF, *TPC, *MORE, getName(),
+                       "Unsupported code model for lowering", MI);
     return false;
   }
   case CodeModel::Small: {



More information about the llvm-commits mailing list