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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-vectorizers

Author: Anutosh Bhat (anutosh491)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/118051.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp (+2-2) 


``````````diff
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);

``````````

</details>


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


More information about the llvm-commits mailing list