[llvm-dev] Doubt regarding getAnalysisUsage

Michael Kruse via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 15 09:30:11 PDT 2019

Am Mi., 14. Aug. 2019 um 22:52 Uhr schrieb Dangeti Tharun kumar
<cs15mtech11002 at iith.ac.in>:
>> >If you do not add
>> setPreservesAll/addPreserved the pass manager will treat your pass as
>> a transformative pass and re-compute SomeAnalysis after your pass has
>> run.
> I am under the impression that the pass manager will re-run the un-preserved analysis passes only if the current pass returns with a 'true'.

The legacy pass manager uses a precomputed pass/analysis execution
order which does not (and cannot) depend on the dynamic return value
of the `runOn...` methods.

The advantage is the that this ensures that passes/analyses are free'd
directly after the last use and will be only computed once (per pass
manager of its level) if all passes preserve it.

The disadvantage is that it will be recomputed even if transforming
passes dynamically decide to not modify the IR.


More information about the llvm-dev mailing list