<div dir="ltr">Hi, List, <div style><br>As you may know, BCC of android makes use of LLVM's major components. Its LTO actually selects some optimizations of LLVM. </div><div style><br></div><div style>I found it can not only use "-functionattrs". I must first use -argpromotion first, or I end up this error:<br>
<div><br></div><div>Pass 'Deduce function attributes' is not initialized.</div><div>Verify if there is a pass dependency cycle.</div><div>Required Passes:</div><div>bcc: external/llvm/lib/VMCore/PassManager.cpp:616: void llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI && "Expected required passes to be initialized"' failed.</div>
<div><br></div><div style>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? </div><div style><div><br>
</div><div>liuxin@rd58:~/testbed$ opt -functionattrs -debug-pass=Structure < pf.bc > /dev/null</div><div>Pass Arguments: -targetlibinfo -no-aa -basiccg -functionattrs -preverify -domtree -verify</div><div>Target Library Information</div>
<div>No Alias Analysis (always returns 'may' alias)</div><div> ModulePass Manager</div><div> Basic CallGraph Construction</div><div> Call Graph SCC Pass Manager</div><div> Deduce function attributes</div>
<div> FunctionPass Manager</div><div> Preliminary module verification</div><div> Dominator Tree Construction</div><div> Module Verifier</div><div> Bitcode Writer</div><div><br></div></div><div>
<br></div><div style>I checked out the latest svn code of LLVM. Clearly, FunctionAttrs requires AliasAnalysis of AU.</div><div style><br></div><div style><div> virtual void getAnalysisUsage(AnalysisUsage &AU) const {</div>
<div> AU.setPreservesCFG();</div><div> AU.addRequired<AliasAnalysis>();</div><div> AU.addRequired<TargetLibraryInfo>();</div><div> CallGraphSCCPass::getAnalysisUsage(AU);</div><div> }</div>
<div><br></div><div>My changeset is almost like this. the issue has gone away. <br></div><div><br></div><div style><div>--- a/lib/Transforms/IPO/FunctionAttrs.cpp</div><div>+++ b/lib/Transforms/IPO/FunctionAttrs.cpp</div>
<div>@@ -76,6 +76,7 @@ namespace {</div><div> char FunctionAttrs::ID = 0;</div><div> INITIALIZE_PASS_BEGIN(FunctionAttrs, "functionattrs",</div><div> "Deduce function attributes", false, false)</div>
<div>+INITIALIZE_AG_DEPENDENCY(AliasAnalysis)</div><div> INITIALIZE_AG_DEPENDENCY(CallGraph)</div><div> INITIALIZE_PASS_END(FunctionAttrs, "functionattrs",</div><div> "Deduce function attributes", false, false)</div>
<div><br></div><div><br></div><div style>Do you guys just miss the dependency for it?</div><div style><br></div><div style>thanks,</div><div style>--lx</div><div style><br></div></div></div></div></div>