[llvm] 13c7617 - [Vectorize] Fix warnings

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 15:46:06 PST 2025


Author: Kazu Hirata
Date: 2025-01-16T15:45:59-08:00
New Revision: 13c761789753862a7cc31a2a26f23010afa668b9

URL: https://github.com/llvm/llvm-project/commit/13c761789753862a7cc31a2a26f23010afa668b9
DIFF: https://github.com/llvm/llvm-project/commit/13c761789753862a7cc31a2a26f23010afa668b9.diff

LOG: [Vectorize] Fix warnings

This patch fixes:

  third-party/unittest/googletest/include/gtest/gtest.h:1379:11:
  error: comparison of integers of different signs: 'const unsigned
  int' and 'const int' [-Werror,-Wsign-compare]

  llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/InstrMaps.h:57:12:
  error: unused variable 'Pair' [-Werror,-Wunused-variable]

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/InstrMaps.h
    llvm/unittests/Transforms/Vectorize/SandboxVectorizer/InstrMapsTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/InstrMaps.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/InstrMaps.h
index 2c4ba30f6fd052..586de53f3a724b 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/InstrMaps.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/InstrMaps.h
@@ -56,6 +56,7 @@ class InstrMaps {
     for (auto [Lane, Orig] : enumerate(Origs)) {
       auto Pair = OrigToVectorMap.try_emplace(Orig, Vec);
       assert(Pair.second && "Orig already exists in the map!");
+      (void)Pair;
       OrigToLaneMap[Orig] = Lane;
     }
   }

diff  --git a/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/InstrMapsTest.cpp b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/InstrMapsTest.cpp
index bcfb8db7f86741..1c8ef7e351aba1 100644
--- a/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/InstrMapsTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/InstrMapsTest.cpp
@@ -64,13 +64,13 @@ define void @foo(i8 %v0, i8 %v1, i8 %v2, i8 %v3, <2 x i8> %vec) {
   EXPECT_EQ(IMaps.getVectorForOrig(Add1), VAdd0);
   EXPECT_FALSE(IMaps.getOrigLane(VAdd0, VAdd0)); // Bad Orig value
   EXPECT_FALSE(IMaps.getOrigLane(Add0, Add0));   // Bad Vector value
-  EXPECT_EQ(*IMaps.getOrigLane(VAdd0, Add0), 0);
-  EXPECT_EQ(*IMaps.getOrigLane(VAdd0, Add1), 1);
+  EXPECT_EQ(*IMaps.getOrigLane(VAdd0, Add0), 0U);
+  EXPECT_EQ(*IMaps.getOrigLane(VAdd0, Add1), 1U);
   // Check when the same vector maps to 
diff erent original values (which is
   // common for vector constants).
   IMaps.registerVector({Add2, Add3}, VAdd0);
-  EXPECT_EQ(*IMaps.getOrigLane(VAdd0, Add2), 0);
-  EXPECT_EQ(*IMaps.getOrigLane(VAdd0, Add3), 1);
+  EXPECT_EQ(*IMaps.getOrigLane(VAdd0, Add2), 0U);
+  EXPECT_EQ(*IMaps.getOrigLane(VAdd0, Add3), 1U);
   // Check when we register for a second time.
 #ifndef NDEBUG
   EXPECT_DEATH(IMaps.registerVector({Add1, Add0}, VAdd0), ".*exists.*");


        


More information about the llvm-commits mailing list