This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen][TargetPassConfig] Add unreachable-mbb-elimination pass explicitly
ClosedPublic

Authored by evgeny777 on Jul 21 2020, 3:32 AM.

Details

Summary

This allows starting from/stopping at this pass when doing partial pipeline execution

Diff Detail

Event Timeline

evgeny777 created this revision.Jul 21 2020, 3:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2020, 3:32 AM
Herald added a subscriber: hiraditya. · View Herald Transcript

This is an unfortunate limit of legacy pass manager lacking runtime pass instrumentation support. NPM has better support of this.

Does this mean that we run UnreachableMachineBlockElimID twice? This new addPass and the old addRequiredID? Is it safe to remove the addRequiredID case?

Does this mean that we run UnreachableMachineBlockElimID twice?

If we execute pipeline normally (e.g llc -O3) then no. We'll pick previously added UnreachableMachineBlockElimID pass when scheduling LiveVariables pass (see PMTopLevelManager::schedulePass and findAnalysisPass)
The only way we can run UnreachableMachineBlockElimID twice is:

llc -O3 -stop-after=unreachable-mbb-elimination foo.ll -o foo.mir
llc -O3 -start-after=unreachable-mbb-elimination foo.mir -o foo.s

In the case above the second command will execute UnreachableMachineBlockElimID again (which is no-op due to absence of dead blocks)

Is it safe to remove the addRequiredID case?

I don't think so. This can cause trouble with pipelines constructed using API calls.

ychen accepted this revision.Jul 22 2020, 11:44 AM

Thanks for the explanation! Could please add a comment like "This allows starting from/stopping at this pass when doing partial pipeline execution"?

This revision is now accepted and ready to land.Jul 22 2020, 11:44 AM
This revision was automatically updated to reflect the committed changes.