[llvm] [InstCombine] Remove unnecessary casts (NFC) (PR #156394)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 1 19:36:58 PDT 2025


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

These variables are already non const.


>From 78582735b62768556edf60416fde763fa4e9cf07 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 1 Sep 2025 00:07:10 -0700
Subject: [PATCH] [InstCombine] Remove unnecessary casts (NFC)

These variables are already non const.
---
 llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 5ed091a631896..1a9b54bc009bc 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2027,9 +2027,7 @@ Instruction *InstCombinerImpl::foldOpIntoPhi(Instruction &I, PHINode *PN,
   }
 
   if (OneUse) {
-    replaceAllDbgUsesWith(const_cast<PHINode &>(*PN),
-                          const_cast<PHINode &>(*NewPN),
-                          const_cast<PHINode &>(*PN), DT);
+    replaceAllDbgUsesWith(*PN, *NewPN, *PN, DT);
   }
   return replaceInstUsesWith(I, NewPN);
 }



More information about the llvm-commits mailing list