[llvm] [CodeGen] Remove an unnecessary cast (NFC) (PR #151901)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 3 22:56:18 PDT 2025


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

getOpcode() already returns unsigned.


>From 877f55cb7d2bfc7e61f80151266799214a3a483b Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 3 Aug 2025 09:04:48 -0700
Subject: [PATCH] [CodeGen] Remove an unnecessary cast (NFC)

getOpcode() already returns unsigned.
---
 llvm/lib/CodeGen/TargetInstrInfo.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp
index 705e046ed3457..9e49dddd46ba6 100644
--- a/llvm/lib/CodeGen/TargetInstrInfo.cpp
+++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp
@@ -993,7 +993,7 @@ static bool canCombine(MachineBasicBlock &MBB, MachineOperand &MO,
     MI = MRI.getUniqueVRegDef(MO.getReg());
   // And it needs to be in the trace (otherwise, it won't have a depth).
   if (!MI || MI->getParent() != &MBB ||
-      ((unsigned)MI->getOpcode() != CombineOpc && CombineOpc != 0))
+      (MI->getOpcode() != CombineOpc && CombineOpc != 0))
     return false;
   // Must only used by the user we combine with.
   if (!MRI.hasOneNonDBGUse(MI->getOperand(0).getReg()))



More information about the llvm-commits mailing list