<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=GB2312" http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
On 3/3/11 3:09 PM, Wenbin Zhang wrote:
<blockquote
cite="mid:85078525D9154266BF80CC611DE857F8@osuc90d096e394"
type="cite">
<meta content="text/html; charset=GB2312"
http-equiv="Content-Type">
<meta name="GENERATOR" content="MSHTML 8.00.6001.19019">
<style></style>
<div><font face="Arial" size="2">Hi all,</font></div>
<div><font face="Arial" size="2">I tried to have a LoopInfo object
in a function pass, add addRequired<LoopInfo> in
getAnalysisUsage, and then use getAnalysis<LoopInfo> in
runOnFunction(). It worked OK.</font></div>
<div><font face="Arial" size="2">Now I want to have a module pass
to traverse the functions, and similarly I want to have to
loop information of the functions. When I did the above in
runOnModule, and run the pass, the following error popped out:</font></div>
<div> </div>
<div><font face="Arial" size="2"><em>AnalysisType&
llvm::Pass::getAnalysis() const [with AnalysisType =
llvm::DominatorTree]: Assertion `Resolver && "Pass
has not been inserted into a PassManager object!"' failed.</em></font></div>
<div><em></em> </div>
<div><font face="Arial" size="2">Can anyone tell me the correct
way to handle this in a module pass? Thanks a lot!</font></div>
</blockquote>
<br>
LoopInfo is a FunctionPass, so you have to use
getAnalysis<LoopInfo>(F) where F is a pointer to the function
that you want analyzed.<br>
<br>
Note that LoopInfo, in this instance, will be re-run every time you
call getAnalysis on it (this is a result of using a FunctionPass
within a ModulePass). Be sure to structure you code to only call
getAnalysis<LoopInfo>(F) on each function just once, if
possible.<br>
<br>
Also be sure that F is not a function declaration (i.e., a function
with no body).<br>
<br>
-- John T.<br>
<br>
<blockquote
cite="mid:85078525D9154266BF80CC611DE857F8@osuc90d096e394"
type="cite">
<div> </div>
<div><font face="Arial" size="2">Best,</font></div>
<div><font face="Arial" size="2">--Wenbin</font></div>
</blockquote>
<br>
</body>
</html>