This is an archive of the discontinued LLVM Phabricator instance.

LiveIntervals: Allow constructing standalone without a PassManager
Needs ReviewPublic

Authored by arsenm on Sep 13 2022, 8:53 AM.

Details

Reviewers
qcolombet
MatzeB
Summary

The verifier is semi-reliant on LiveIntervals in a weird way. The
verifier has its own liveness analysis, which misses some things
caught with LiveIntervals. As a consequence, llvm-reduce's use of the
verifier fails to filter out some invalid MIR. Allow constructing
LiveIntervals independently of a PassManager, so that llvm-reduce can
use this directly in its passless verify calls. Additionally, some
reductions should directly inspect the LiveIntervals.

Diff Detail

Event Timeline

arsenm created this revision.Sep 13 2022, 8:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 13 2022, 8:53 AM
arsenm requested review of this revision.Sep 13 2022, 8:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 13 2022, 8:53 AM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm updated this revision to Diff 459780.Sep 13 2022, 9:19 AM

Fix bad patch split

I think it's fair to have a version of the algorithm that is not an analysis pass. It feels a bit odd, that the classes are subclasses of MachineFunctionPass but can now (also) be created independently without actually being added to a pass manager, but I guess it avoids a log of refactoring, so okay...

llvm/include/llvm/CodeGen/LiveIntervals.h
101–102

This constructor doesn't have a definition. Is it from an early version and you meant to remove it?

105–106

This probably deserves a comment, mentioning that it should be used when constructor LiveIntervals independently without being an actual AnalysisPass.

I'd prefer compute as a name, but no strong opinion.

llvm/include/llvm/CodeGen/SlotIndexes.h
360

Maybe call it compute to fit the pattern of the LiveIntervals code. Again no strong opinion.

llvm/lib/CodeGen/LiveIntervals.cpp
120–121

Make Indexes_ and DT_ parameters references to indicate that they must not be nullptr.