-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[llvm][HashRecognize] Fix compiler warning on Arm 32-bit #161821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
/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.
@llvm/pr-subscribers-llvm-analysis Author: David Spickett (DavidSpickett) Changes
With a static cast to size_t. I thought about using Latch->size() but this skips a call to Full diff: https://github.com/llvm/llvm-project/pull/161821.diff 1 Files Affected:
diff --git a/llvm/lib/Analysis/HashRecognize.cpp b/llvm/lib/Analysis/HashRecognize.cpp
index 5d7ee1fe8eb12..613199a5d9f7b 100644
--- a/llvm/lib/Analysis/HashRecognize.cpp
+++ b/llvm/lib/Analysis/HashRecognize.cpp
@@ -97,7 +97,8 @@ static bool containsUnreachable(const Loop &L,
}
}
}
- return std::distance(Latch->begin(), Latch->end()) != Visited.size();
+ return static_cast<size_t>(std::distance(Latch->begin(), Latch->end())) !=
+ Visited.size();
}
/// A structure that can hold either a Simple Recurrence or a Conditional
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Please use Latch->size()
.
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
By using Latch->size() instead.