https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/179893
Backport 209ff8bf06dd12becd79c1ebb01612c021e19f6c Requested by: @wzssyqa >From 8175b4d49cd3f312d18368af7970995d47a56485 Mon Sep 17 00:00:00 2001 From: YunQiang Su <[email protected]> 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; } } _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
