[llvm] b4f54bf - [llvm][LoongArch] Fix compiler warning produced by assert
David Spickett via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 3 08:11:43 PDT 2025
Author: David Spickett
Date: 2025-10-03T15:11:18Z
New Revision: b4f54bf548839ebe3308b1979b448403c2ba2a81
URL: https://github.com/llvm/llvm-project/commit/b4f54bf548839ebe3308b1979b448403c2ba2a81
DIFF: https://github.com/llvm/llvm-project/commit/b4f54bf548839ebe3308b1979b448403c2ba2a81.diff
LOG: [llvm][LoongArch] Fix compiler warning produced by assert
Fixes #154918
tion ‘llvm::SDValue fillSubVectorFromBuildVector(llvm::BuildVectorSDNode*, llvm::SelectionDAG&, llvm::SDLoc, const llvm::LoongArchSubtarget&, llvm::EVT, unsigned int)’:
/home/davspi01/work/open_source/llvm-project/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp:2863:16: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]
2863 | assert(first >= 0 &&
| ~~~~~~^~~~
first is unsigned so this part of the expression is redundant.
Added:
Modified:
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
index 4cfbfca45d359..7ddf996f53f4c 100644
--- a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
@@ -2860,8 +2860,7 @@ static SDValue fillSubVectorFromBuildVector(BuildVectorSDNode *Node,
EVT ResTy, unsigned first) {
unsigned NumElts = ResTy.getVectorNumElements();
- assert(first >= 0 &&
- first + NumElts <= Node->getSimpleValueType(0).getVectorNumElements());
+ assert(first + NumElts <= Node->getSimpleValueType(0).getVectorNumElements());
SmallVector<SDValue, 16> Ops(Node->op_begin() + first,
Node->op_begin() + first + NumElts);
More information about the llvm-commits
mailing list