[llvm] 8bb1bdf - [X86] Fix warnings

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 08:48:31 PST 2024


Author: Kazu Hirata
Date: 2024-12-17T08:48:23-08:00
New Revision: 8bb1bdf919c76ec047fd5c646fa210837e88cc75

URL: https://github.com/llvm/llvm-project/commit/8bb1bdf919c76ec047fd5c646fa210837e88cc75
DIFF: https://github.com/llvm/llvm-project/commit/8bb1bdf919c76ec047fd5c646fa210837e88cc75.diff

LOG: [X86] Fix warnings

This patch fixes:

  llvm/lib/Target/X86/X86ISelLowering.cpp:30127:23: error: comparison
  of integers of different signs: 'int' and 'unsigned int'
  [-Werror,-Wsign-compare]

  llvm/lib/Target/X86/X86ISelLowering.cpp:30205:35: error: comparison
  of integers of different signs: 'int' and 'unsigned int'
  [-Werror,-Wsign-compare]

  llvm/lib/Target/X86/X86ISelLowering.cpp:30453:23: error: comparison
  of integers of different signs: 'int' and 'unsigned int'
  [-Werror,-Wsign-compare]

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 4ed0a886c9d298..efe5c2464dc007 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -30124,7 +30124,7 @@ static SDValue LowerShift(SDValue Op, const X86Subtarget &Subtarget,
     // be treated identically.
     SmallVector<SDValue, 32> AmtWideElts;
     AmtWideElts.reserve(NumElts);
-    for (int I = 0; I != NumElts; ++I) {
+    for (unsigned I = 0; I != NumElts; ++I) {
       AmtWideElts.push_back(Amt.getOperand(I));
     }
     SmallVector<SDValue, 32> TmpAmtWideElts;
@@ -30200,7 +30200,7 @@ static SDValue LowerShift(SDValue Op, const X86Subtarget &Subtarget,
         (WideEltSizeInBits < 32 || IsConstantSplat) && !Subtarget.hasAVX2()) {
       Profitable = false;
     }
-    int WideNumElts = AmtWideElts.size();
+    unsigned WideNumElts = AmtWideElts.size();
     // We are only dealing with identical pairs.
     if (Profitable && WideNumElts != NumElts) {
       MVT WideScalarVT = MVT::getIntegerVT(WideEltSizeInBits);
@@ -30450,7 +30450,7 @@ static SDValue LowerShift(SDValue Op, const X86Subtarget &Subtarget,
     }
 
     SmallVector<SDValue, 16> LoAmt, HiAmt;
-    for (int i = 0; i != NumElts; i += 16) {
+    for (unsigned i = 0; i != NumElts; i += 16) {
       for (int j = 0; j != 8; ++j) {
         LoAmt.push_back(Amt.getOperand(i + j));
         HiAmt.push_back(Amt.getOperand(i + j + 8));


        


More information about the llvm-commits mailing list