-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
[BOLT] [Passes] Fix two compile warnings in BOLT #73086
Conversation
✅ With the latest revision this PR passed the C/C++ code formatter. |
I use |
friendly ping |
@@ -1467,7 +1466,7 @@ void IndirectCallPromotion::runOnFunctions(BinaryContext &BC) { | |||
std::max<uint64_t>(TotalIndexBasedCandidates, 1)) | |||
<< "%\n"; | |||
|
|||
(void)verifyProfile; | |||
(void)verifyProfile(BFs); |
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.
This is not the same. This will run verifyProfile(), which will cause an unnecessary slow down in no-debug mode. The previous code wasn't running anything, it was just making a reference to silence a compiler warning about verifyProfile being unused.
I believe the proper fix is actually to surround the definition of verifyProfile in #ifndef NDEBUG..#endif in the same way as it is use is.
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.
Thank you for your review. Do you mean I need to delete this line of code?
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.
Correct. Delete the line entirely and surround the definition of verifyProfile with #ifndef, like that:
#ifndef NDEBUG
definition goes here
#endif
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.
Github doesn't let me comment on unchanged code, but line 161 would look like this:
#ifndef NDEBUG
static bool verifyProfile(std::map<uint64_t, BinaryFunction> &BFs) {
bool IsValid = true;
for (auto &BFI : BFs) {
BinaryFunction &BF = BFI.second;
if (!BF.isSimple())
continue;
for (const BinaryBasicBlock &BB : BF) {
auto BI = BB.branch_info_begin();
for (BinaryBasicBlock *SuccBB : BB.successors()) {
if (BI->Count != BinaryBasicBlock::COUNT_NO_PROFILE && BI->Count > 0) {
if (BB.getKnownExecutionCount() == 0 ||
SuccBB->getKnownExecutionCount() == 0) {
errs() << "BOLT-WARNING: profile verification failed after ICP for "
"function "
<< BF << '\n';
IsValid = false;
}
}
++BI;
}
}
}
return IsValid;
}
#endif
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.
The code has been modified, please review it, thank you!
Fix build issue on Windows. issue:llvm#73085
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.
Thanks!
Please help me merge it, thank you! |
Fix build issue on Windows.
issue:#73085
@maksfb PTAL thank you