This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] [NFC] Remove unused variable
ClosedPublic

Authored by paulkirth on Apr 27 2022, 5:38 PM.

Details

Summary

This patch fixes a warning from -Wunused-but-set-variable
MismatchedBranches are counted, but are never reported.
Since evaluateProfileData() should already identify and report
these cases, we can safely remove the unused variable.

Diff Detail

Event Timeline

paulkirth created this revision.Apr 27 2022, 5:38 PM
Herald added a reviewer: Amir. · View Herald Transcript
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: ayermolo. · View Herald Transcript
paulkirth requested review of this revision.Apr 27 2022, 5:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2022, 5:38 PM

I'm unsure if this is the right thing to do here, but I wanted to fix the waring, or pull in someone who has better understanding of the right approach

rafauler requested changes to this revision.May 2 2022, 5:17 PM

Thanks for finding this issue. This was originally introduced in d15b93badec2ffdfc6e5a01b9386cdefb4ea59ac by @maksfb . I'm not sure he had the intent of reporting these, probably not. By looking at the code now, when we reach these lines, we should've already gone through a call to evaluateProfileData, which is the real function that is taking care of seeing how many mismatches we have and reporting these. That's why I see no reason to report this here, so you can change this diff to just remove the declaration of MismatchedBranches and ++MismatchedBranches++.

This revision now requires changes to proceed.May 2 2022, 5:17 PM

Thanks for the feedback. Removing the variable was another approach I considered, but it seemed important. Since its redundant, I'll just update the patch as you've suggested.

paulkirth updated this revision to Diff 426548.May 2 2022, 5:30 PM

Since reporting mismatched branches here is redundant, we can just remove the unused variable

rafauler accepted this revision.May 2 2022, 5:43 PM

Thanks!

This revision is now accepted and ready to land.May 2 2022, 5:43 PM
paulkirth retitled this revision from [BOLT] Warn about the number of mismatched branches to [BOLT] [NFC] Remove unused variable.May 3 2022, 8:13 AM
paulkirth edited the summary of this revision. (Show Details)
paulkirth edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.