This is an archive of the discontinued LLVM Phabricator instance.

[test] Cleanup some CGSCCPassManager tests
ClosedPublic

Authored by aeubanks on Dec 16 2020, 4:02 PM.

Details

Summary

Don't iterate over SCC as we potentially modify it.
Verify module (and fix some broken ones).
Only run pass once and make sure that it's actually run.
Rename tests to just end in a number since I'm planning on adding a
bunch more which won't have good individual names. Instead, add comments
on the transformations that each test does.

Diff Detail

Event Timeline

aeubanks requested review of this revision.Dec 16 2020, 4:02 PM
aeubanks created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 16 2020, 4:02 PM
rnk added inline comments.Dec 16 2020, 4:22 PM
llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
1809

What do you think of this as an alternative code pattern for safe iteration of the nodes?

for (... N : std::vector<LazyCallGraph::Node*>(C.begin(), C.end())) { ... }
rnk accepted this revision.Dec 16 2020, 4:22 PM

lgtm, the comment is a suggestion

This revision is now accepted and ready to land.Dec 16 2020, 4:22 PM
aeubanks added inline comments.Dec 16 2020, 4:24 PM
llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
1809

I initially attempted something like that, the issue is that C.begin()/end() return references and not pointers.

This revision was landed with ongoing or failed builds.Dec 16 2020, 4:28 PM
This revision was automatically updated to reflect the committed changes.
rnk added inline comments.Dec 16 2020, 4:58 PM
llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
1809

Well, we could make it happen with mapped_iterator, or perhaps just encapsulating the vector construction into a function that returns the right std::vector.