Skip to content

Commit 5859523

Browse files
committed
[llvm][HashRecognize] Fix compiler warning on Arm 32-bit
/home/david.spickett/llvm-project/llvm/lib/Analysis/HashRecognize.cpp:100:54: warning: comparison of integers of different signs: 'typename iterator_traits<ilist_iterator_w_bits<node_options<Instruction, true, false, void, true, BasicBlock>, false, false>>::difference_type' (aka 'int') and 'size_type' (aka 'unsigned int') [-Wsign-compare] 100 | return std::distance(Latch->begin(), Latch->end()) != Visited.size(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ With a static cast to size_t. I thought about using Latch->size() but this skips a call to `It.setHeadBit(true);` and I'm not sure whether that would make a difference in this context.
1 parent 1a07e67 commit 5859523

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Analysis/HashRecognize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ static bool containsUnreachable(const Loop &L,
9797
}
9898
}
9999
}
100-
return std::distance(Latch->begin(), Latch->end()) != Visited.size();
100+
return static_cast<size_t>(std::distance(Latch->begin(), Latch->end())) !=
101+
Visited.size();
101102
}
102103

103104
/// A structure that can hold either a Simple Recurrence or a Conditional

0 commit comments

Comments
 (0)