Skip to content

Commit 89e919f

Browse files
authored
Fix warnings while compiling SLPVectorizer.cpp (#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. ``` /Users/anutosh491/work/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6924:67: warning: comparison of integers of different signs: 'typename iterator_traits<user_iterator_impl<User>>::difference_type' (aka 'long') and 'unsigned int' [-Wsign-compare] 6924 | if (std::distance(LI->user_begin(), LI->user_end()) != | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ 6925 | LI->getNumUses()) | ~~~~~~~~~~~~~~~~ [ 79%] Building CXX object lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o /Users/anutosh491/work/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:9754:43: warning: comparison of integers of different signs: 'typename iterator_traits<Value *const *>::difference_type' (aka 'long') and 'unsigned int' [-Wsign-compare] 9754 | count(Slice, Slice.front()) == | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ 9755 | (isa<UndefValue>(Slice.front()) ? VF - 1 : 1)) { ``` This PR tries to address those warnings.
1 parent 452efb3 commit 89e919f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -6922,8 +6922,8 @@ void BoUpSLP::tryToVectorizeGatheredLoads(
69226922
// 2. All users are deleted.
69236923
// 3. The load broadcasts are not allowed or the load is not
69246924
// broadcasted.
6925-
if (std::distance(LI->user_begin(), LI->user_end()) !=
6926-
LI->getNumUses())
6925+
if (static_cast<unsigned int>(std::distance(
6926+
LI->user_begin(), LI->user_end())) != LI->getNumUses())
69276927
return false;
69286928
if (!IsLegalBroadcastLoad)
69296929
continue;
@@ -9716,7 +9716,8 @@ void BoUpSLP::transformNodes() {
97169716
Slice.front()->getType(), 2 * VF)),
97179717
1U, 2 * VF)) ||
97189718
count(Slice, Slice.front()) ==
9719-
(isa<UndefValue>(Slice.front()) ? VF - 1 : 1)) {
9719+
static_cast<long>(isa<UndefValue>(Slice.front()) ? VF - 1
9720+
: 1)) {
97209721
if (IsSplat)
97219722
continue;
97229723
InstructionsState S = getSameOpcode(Slice, *TLI);

0 commit comments

Comments
 (0)