[llvm-branch-commits] [llvm] release/22.x: MIPS: Fix unsigned compare with zero in MipsSEInstrInfo::copyPhysReg (#179866) (PR #179893)
Cullen Rhodes via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Feb 9 01:51:15 PST 2026
https://github.com/c-rhodes updated https://github.com/llvm/llvm-project/pull/179893
>From 401d7166ed107bf770b3ba424bdfcd4a39a8742c Mon Sep 17 00:00:00 2001
From: YunQiang Su <syq at debian.org>
Date: Thu, 5 Feb 2026 17:09:22 +0800
Subject: [PATCH] MIPS: Fix unsigned compare with zero in
MipsSEInstrInfo::copyPhysReg (#179866)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
SrcRegOff >= 0 is not needed at all for unsigned.
This fixes the warning:
```
llvm/lib/Target/Mips/MipsSEInstrInfo.cpp: In member function ‘virtual void llvm::MipsSEInstrInfo::copyPhysReg(llvm::MachineBasicBlock&, llvm::MachineBasicBlock::iterator, const llvm::DebugLoc&, llvm::Register, llvm::Register, bool, bool, bool) const’:
llvm/lib/Target/Mips/MipsSEInstrInfo.cpp:245:48: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]
245 | if (SrcRegOff == DestRegOff && SrcRegOff >= 0 && SrcRegOff <= 31)
| ~~~~~~~~~~^~~~
llvm/lib/Target/Mips/MipsSEInstrInfo.cpp:256:48: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]
256 | if (SrcRegOff == DestRegOff && SrcRegOff >= 0 && SrcRegOff <= 31)
```
(cherry picked from commit 209ff8bf06dd12becd79c1ebb01612c021e19f6c)
---
llvm/lib/Target/Mips/MipsSEInstrInfo.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/Mips/MipsSEInstrInfo.cpp b/llvm/lib/Target/Mips/MipsSEInstrInfo.cpp
index 4a92b1ffc4cf9..90f2996e7f93e 100644
--- a/llvm/lib/Target/Mips/MipsSEInstrInfo.cpp
+++ b/llvm/lib/Target/Mips/MipsSEInstrInfo.cpp
@@ -242,7 +242,7 @@ void MipsSEInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
Opc = Mips::FMOV_D64;
unsigned DestRegOff = DestReg.id() - Mips::D0_64;
unsigned SrcRegOff = SrcReg.id() - Mips::F0;
- if (SrcRegOff == DestRegOff && SrcRegOff >= 0 && SrcRegOff <= 31)
+ if (SrcRegOff == DestRegOff && SrcRegOff <= 31)
return;
}
} else if (Opc == 0 && Mips::FGR32RegClass.contains(DestReg) &&
@@ -253,7 +253,7 @@ void MipsSEInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
Opc = Mips::FMOV_D32;
unsigned DestRegOff = DestReg.id() - Mips::F0;
unsigned SrcRegOff = SrcReg.id() - Mips::D0_64;
- if (SrcRegOff == DestRegOff && SrcRegOff >= 0 && SrcRegOff <= 31)
+ if (SrcRegOff == DestRegOff && SrcRegOff <= 31)
return;
}
}
More information about the llvm-branch-commits
mailing list