[LLVMdev] General questions about PassManager and the removed SimplifyLibraryCalls pass
Daniel Liew
daniel.liew at imperial.ac.uk
Fri Apr 4 19:13:57 PDT 2014
Hi,
I've been going the PassManager documentation and reading some of the
code and there a few things that aren't obvious (at least) to me that
I'd like to understand.
1. It seems the opt tool is aware of the dependencies of Transforms
(e.g. Global Value Numbering) and adds its the analyses it depends on
to the PassManager. It looks like the dependencies are specified using
macros
lib/Transforms/Scalar/GVN.cpp
```
INITIALIZE_PASS_BEGIN(GVN, "gvn", "Global Value Numbering", false, false)
INITIALIZE_PASS_DEPENDENCY(MemoryDependenceAnalysis)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
INITIALIZE_PASS_END(GVN, "gvn", "Global Value Numbering", false, false)
```
But also in
```
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<TargetLibraryInfo>();
if (!NoLoads)
AU.addRequired<MemoryDependenceAnalysis>();
AU.addRequired<AliasAnalysis>();
AU.addPreserved<DominatorTreeWrapperPass>();
AU.addPreserved<AliasAnalysis>();
}
```
Why are these dependencies stated twice, once in getAnalysisUsage()
and the other using macros?
If I am using my a PassManager in my own tool and add a transform like
GVN do I manually need to add the analyses it depends on to the
PassManager before adding the Transform itself or does the PassManager
do something smart and add the Analyses automatically like the opt
tool does?
2. I recently noticed that the SimplifyLibraryCallsPass was removed
and according to the LLVM3.4 release notes its functionality is now in
"instruction combiner and function attribute marking passes". I was
wondering, which function attributes passes were meant?
I took a look at opt's code and it seems to add the TargetLibraryInfo
pass. Is there anything I need to do with this pass (possibly add to
the pass manager depending on the answer to 1) to achieve the same
transform that SimplifyLibraryCalls did?
Thanks,
Dan Liew.
More information about the llvm-dev
mailing list