Liu Xin
2013-Sep-05 06:01 UTC
[LLVMdev] why functionattrs doesn't add dependency of AliasAnalysis
Hi, List, As you may know, BCC of android makes use of LLVM's major components. Its LTO actually selects some optimizations of LLVM. I found it can not only use "-functionattrs". I must first use -argpromotion first, or I end up this error: Pass 'Deduce function attributes' is not initialized. Verify if there is a pass dependency cycle. Required Passes: bcc: external/llvm/lib/VMCore/PassManager.cpp:616: void llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI && "Expected required passes to be initialized"' failed. The strangest thing is the opt doesn't suffer from this issue. please note that directly use -functionattrs, it can run without AliasAnalysis. Could you explain why? liuxin at rd58:~/testbed$ opt -functionattrs -debug-pass=Structure < pf.bc > /dev/null Pass Arguments: -targetlibinfo -no-aa -basiccg -functionattrs -preverify -domtree -verify Target Library Information No Alias Analysis (always returns 'may' alias) ModulePass Manager Basic CallGraph Construction Call Graph SCC Pass Manager Deduce function attributes FunctionPass Manager Preliminary module verification Dominator Tree Construction Module Verifier Bitcode Writer I checked out the latest svn code of LLVM. Clearly, FunctionAttrs requires AliasAnalysis of AU. virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); AU.addRequired<AliasAnalysis>(); AU.addRequired<TargetLibraryInfo>(); CallGraphSCCPass::getAnalysisUsage(AU); } My changeset is almost like this. the issue has gone away. --- a/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/lib/Transforms/IPO/FunctionAttrs.cpp @@ -76,6 +76,7 @@ namespace { char FunctionAttrs::ID = 0; INITIALIZE_PASS_BEGIN(FunctionAttrs, "functionattrs", "Deduce function attributes", false, false) +INITIALIZE_AG_DEPENDENCY(AliasAnalysis) INITIALIZE_AG_DEPENDENCY(CallGraph) INITIALIZE_PASS_END(FunctionAttrs, "functionattrs", "Deduce function attributes", false, false) Do you guys just miss the dependency for it? thanks, --lx -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130905/9b5d6351/attachment.html>
Nick Lewycky
2013-Sep-05 08:24 UTC
[LLVMdev] why functionattrs doesn't add dependency of AliasAnalysis
Liu Xin wrote:> Hi, List, > > As you may know, BCC of android makes use of LLVM's major components. > Its LTO actually selects some optimizations of LLVM. > > I found it can not only use "-functionattrs". I must first use > -argpromotion first, or I end up this error: > > Pass 'Deduce function attributes' is not initialized. > Verify if there is a pass dependency cycle. > Required Passes: > bcc: external/llvm/lib/VMCore/PassManager.cpp:616: void > llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI && > "Expected required passes to be initialized"' failed. > > The strangest thing is the opt doesn't suffer from this issue. please > note that directly use -functionattrs, it can run without AliasAnalysis. > Could you explain why? > > liuxin at rd58:~/testbed$ opt -functionattrs -debug-pass=Structure < pf.bc > > /dev/null > Pass Arguments: -targetlibinfo -no-aa -basiccg -functionattrs > -preverify -domtree -verify > Target Library Information > No Alias Analysis (always returns 'may' alias) > ModulePass Manager > Basic CallGraph Construction > Call Graph SCC Pass Manager > Deduce function attributes > FunctionPass Manager > Preliminary module verification > Dominator Tree Construction > Module Verifier > Bitcode Writer > > > I checked out the latest svn code of LLVM. Clearly, FunctionAttrs > requires AliasAnalysis of AU. > > virtual void getAnalysisUsage(AnalysisUsage &AU) const { > AU.setPreservesCFG(); > AU.addRequired<AliasAnalysis>(); > AU.addRequired<TargetLibraryInfo>(); > CallGraphSCCPass::getAnalysisUsage(AU); > } > > My changeset is almost like this. the issue has gone away. > > --- a/lib/Transforms/IPO/FunctionAttrs.cpp > +++ b/lib/Transforms/IPO/FunctionAttrs.cpp > @@ -76,6 +76,7 @@ namespace { > char FunctionAttrs::ID = 0; > INITIALIZE_PASS_BEGIN(FunctionAttrs, "functionattrs", > "Deduce function attributes", false, false) > +INITIALIZE_AG_DEPENDENCY(AliasAnalysis) > INITIALIZE_AG_DEPENDENCY(CallGraph) > INITIALIZE_PASS_END(FunctionAttrs, "functionattrs", > "Deduce function attributes", false, false) > > > Do you guys just miss the dependency for it?I think we missed the dependency for it. Fixed in r190035. Thanks! Nick
Maybe Matching Threads
- [LLVMdev] Assertion `PI && "Expected required passes to be initialized"' failed for AliasAnalysis.
- [LLVMdev] Assertion `PI && "Expected required passes to be initialized"' failed for AliasAnalysis.
- [LLVMdev] Infinite loop when adding a new analysis pass
- [LLVMdev] Error when trying to chain two llvm transform passes
- [LLVMdev] Adding dependency on MemoryDependenceAnalysis pass to LICM causes opt to get stuck in addPass