[llvm-dev] possible inconsistency in PassManagerInternal.h

De Azevedo Piovezan, Felipe via llvm-dev llvm-dev at lists.llvm.org
Sun Sep 2 13:22:45 PDT 2018


Hello,
(fairly new around here, apologies if the question has an obvious answer)

I've been studying the structure of the new PassManager in the hopes of using it soon. After watching a couple of talks (Chandler / Sergeev), I decided to start with the Concept/Model classes in PassManagerInternal.h
While I could make sense of almost everything there, two details caught my attention:

1-  The PassConcept abstract class has a function `run = 0;` which returns an object of type `PreservedAnalysis`. Such object is forward-declared in this header, but it is defined in PassManager.h  This is the only place in the file where we reference this class.

However, right after, we define the PassModel class which derives from PassConcept, and one of its template parameters is a typename `PreservedAnalysisT`. The implementation of the `run` method uses the keyword override and it returns an object of type `PreservedAnalysisT`.
This should raise a warning if PreservedAnalysisT != PreservedAnalysis.   Is this intentional? My naive intuition is that we should have removed PreservedAnalysisT from the template and used PreservedAnalysis. However, everywhere else in the file PreservedAnalysisT is used as template parameter.

Am I missing something obvious?

2- A similar issue arises when using AnalysisManager.

Both PassConcept  and PassModel have a template typename `AnalysisManagerT`.
However, AnalysisPassConcept and AnalysisPassModel have no such template parameter; instead, they use the forward-declared AnalysisManager type, defined in PassManager.h

Again, is there a particular reason for this apparent inconsistency?

Thanks!
--
Felipe de Azevedo Piovezan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180902/a33e64ee/attachment.html>


More information about the llvm-dev mailing list