This is an archive of the discontinued LLVM Phabricator instance.

Add BAT testing framework
ClosedPublic

Authored by rafauler on Jul 8 2022, 10:07 AM.

Details

Summary

This patch refactors BAT to be testable as a library, so we
can have open-source tests on it. This further fixes an issue with
basic blocks that lack a valid input offset, making BAT omit those
when writing translation tables.

Test Plan: new testcases added, new testing tool added (llvm-bat-dump)

Diff Detail

Event Timeline

rafauler created this revision.Jul 8 2022, 10:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2022, 10:07 AM
Herald added a subscriber: mgorny. · View Herald Transcript
rafauler requested review of this revision.Jul 8 2022, 10:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2022, 10:07 AM
maksfb added inline comments.Jul 11 2022, 5:43 PM
bolt/lib/Passes/ValidateInternalCalls.cpp
96

Unrelated to this patch: we need to iterate over the copy of BBs as we increase the size inside the loop potentially invalidating the iterator.

maksfb added inline comments.Jul 11 2022, 6:08 PM
bolt/lib/Passes/ValidateInternalCalls.cpp
108

For the new block, we can set the offset to that of the instruction following the call.

rafauler added inline comments.Jul 13 2022, 6:12 PM
bolt/lib/Passes/ValidateInternalCalls.cpp
96

When this function creates a new block and potentially invalidates iterators (for both BBs and mcinsts), it stops the loop (returns true). So there is no issue with invalidation here.

maksfb accepted this revision.Jul 22 2022, 5:23 PM
maksfb added inline comments.
bolt/lib/Passes/ValidateInternalCalls.cpp
96

I see now. Agree it will not crash.

This revision is now accepted and ready to land.Jul 22 2022, 5:23 PM
This revision was landed with ongoing or failed builds.Jul 29 2022, 2:56 PM
This revision was automatically updated to reflect the committed changes.