[llvm] 1782168 - [X86] Fix a warning

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 10:02:29 PST 2025


Author: Kazu Hirata
Date: 2025-01-27T10:02:21-08:00
New Revision: 1782168c527bbb9756c96a95f82397b5952d32b4

URL: https://github.com/llvm/llvm-project/commit/1782168c527bbb9756c96a95f82397b5952d32b4
DIFF: https://github.com/llvm/llvm-project/commit/1782168c527bbb9756c96a95f82397b5952d32b4.diff

LOG: [X86] Fix a warning

This patch fixes:

  llvm/lib/Target/X86/X86TargetTransformInfo.cpp:1583:47: error:
  comparison of integers of different signs: 'size_t' (aka 'unsigned
  long') and 'typename iterator_traits<const int *>::difference_type'
  (aka 'long') [-Werror,-Wsign-compare]

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index a64d65cb770b0f..22dccaf061e1fd 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -1580,9 +1580,10 @@ InstructionCost X86TTIImpl::getShuffleCost(
                ((P.value() % Mask.size()) / NumEltsPerLane) ==
                    (P.index() / NumEltsPerLane);
       });
-      IsSingleElementMask = (Mask.size() - 1) == count_if(Mask, [](int M) {
-                              return M == PoisonMaskElem;
-                            });
+      IsSingleElementMask =
+          (Mask.size() - 1) == static_cast<unsigned>(count_if(Mask, [](int M) {
+            return M == PoisonMaskElem;
+          }));
     }
   }
 


        


More information about the llvm-commits mailing list