[llvm] Fix warnings while compiling SLPVectorizer.cpp (PR #118051)

Anutosh Bhat via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 28 22:18:11 PST 2024


https://github.com/anutosh491 created https://github.com/llvm/llvm-project/pull/118051

Towards #118048

I was building llvm (clang and lld) for webassembly and came across these warnings. Not sure if they are seen in our builds too. This PR tries to address those warnings.

>From 9c0a8c44a12b13029cff79eaa7dd0d625dd4d99c Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat491 at gmail.com>
Date: Fri, 29 Nov 2024 11:46:22 +0530
Subject: [PATCH] Fix warnings while compiling SLPVectorizer.cpp

---
 llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 48a8520a966fc7..f0e20e870f7a16 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -6919,7 +6919,7 @@ void BoUpSLP::tryToVectorizeGatheredLoads(
               // 2. All users are deleted.
               // 3. The load broadcasts are not allowed or the load is not
               // broadcasted.
-              if (std::distance(LI->user_begin(), LI->user_end()) !=
+              if (static_cast<unsigned int>(std::distance(LI->user_begin(), LI->user_end())) !=
                       LI->getNumUses())
                 return false;
               if (!IsLegalBroadcastLoad)
@@ -9762,7 +9762,7 @@ void BoUpSLP::transformNodes() {
                                              Slice.front()->getType(), 2 * VF)),
                                          1U, 2 * VF)) ||
               count(Slice, Slice.front()) ==
-                  (isa<UndefValue>(Slice.front()) ? VF - 1 : 1)) {
+                  static_cast<long>(isa<UndefValue>(Slice.front()) ? VF - 1 : 1)) {
             if (IsSplat)
               continue;
             InstructionsState S = getSameOpcode(Slice, *TLI);



More information about the llvm-commits mailing list