This is an archive of the discontinued LLVM Phabricator instance.

[StandardInstrumentations] Handle case where block order changes
ClosedPublic

Authored by aeubanks on Jul 26 2022, 1:07 PM.

Details

Summary

Previously we'd go off the end of the BI iterator because we expected
that the relative positions of common blocks before and after were
consistent. That's not always true though, for example with
jump-threading.

Diff Detail

Event Timeline

aeubanks created this revision.Jul 26 2022, 1:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2022, 1:07 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
aeubanks requested review of this revision.Jul 26 2022, 1:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2022, 1:07 PM

Sorry for the delay, missed this before going on vacation.

llvm/lib/Passes/StandardInstrumentations.cpp
553

I don't understand why you are removing this line. On exiting the loop, (with your change to the loop) BI == BE or *BI == *AI. In the latter case, we still want to advance BI or HandlePotentiallyRemovedData will be called with it on the next time through this loop (AI advances and the above loop will enter when BI != BE and HandlePotentiallyRemovedData will be called with BI before it is advanced). Shouldn't this line be guarded with "if (BI != BE)" instead of being removed?

aeubanks added inline comments.Aug 7 2022, 1:50 PM
llvm/lib/Passes/StandardInstrumentations.cpp
553

you're right, fixed

jamieschmeiser accepted this revision.Aug 8 2022, 5:50 AM

LGTM. Thanks.

This revision is now accepted and ready to land.Aug 8 2022, 5:50 AM
This revision was landed with ongoing or failed builds.Aug 8 2022, 7:41 AM
This revision was automatically updated to reflect the committed changes.