<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div>
<div>
<div>
<div dir="ltr">
<div style="color: black; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont">
Dear Michael,</div>
<div style="color: black; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont">
<br>
</div>
<div style="color: black; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont">
    Thanks a lot for your suggestion but I not sure whether it is caused by this initialization because for example, I do not do such initialization for LoopInfoWrapperPass in my code but it works fine.</div>
<div style="color: black; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont">
<br>
</div>
<div style="color: black; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont">
    I tried your solution for the pass but got the following compilation error ----> namespace "llvm" has no member "initializeLoopInformationCollectPass".</div>
<div style="color: black; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont">
<br>
</div>
<div style="color: black; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont">
    Such error is raised from the macro define: <font size="2"><span style="font-size:11pt">INITIALIZE_PASS_END</span></font>. Does it mean I need to specially define such function in the LLVM namespace?</div>
<div style="color: black; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont">
<br>
</div>
<div style="color: black; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont">
    Thanks again for your time and patience!<br>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<span id="ms-rterangepaste-start"></span>
<div><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">Best regards,</span></font><span style="font-size:12pt">
</span><span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">------------------------------------------</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">Tingyuan LIANG</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">MPhil Student</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">Department of Electronic and Computer Engineering</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">The Hong Kong University of Science and Technology</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span><span style="font-size:12pt"></span><span id="ms-rterangepaste-end"></span></div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Michael Kruse <llvmdev@meinersbur.de><br>
<b>Sent:</b> Saturday, February 2, 2019 6:10 AM<br>
<b>To:</b> Tingyuan LIANG<br>
<b>Cc:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm-dev] Confusing ERROR with LoopAccessLegacyAnalysis: Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized.</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi,<br>
<br>
you will have to call<br>
initializeLoopAccessLegacyAnalysisPass(*PassRegistry::getPassRegistry())<br>
before you can use it as a pass dependency. This is usually done by a<br>
sequence of<br>
<br>
INITIALIZE_PASS_BEGIN(YourPass, "your_pass", "Your Pass Name", false, false)<br>
INITIALIZE_PASS_DEPENDENCY(LoopAccessLegacyAnalysis)<br>
INITIALIZE_PASS_END(YourPass, "your_pass", "Your Pass Name", false, false)<br>
<br>
which also creates an initializer for your pass:<br>
initializeYourPassPass which you should call in some way in your<br>
application.<br>
<br>
Michael<br>
<br>
<br>
Am Fr., 1. Feb. 2019 um 12:58 Uhr schrieb Tingyuan LIANG via llvm-dev<br>
<llvm-dev@lists.llvm.org>:<br>
><br>
> Dear all,<br>
><br>
>     I write a new LoopPass which wants to use passes including LoopInfoWrapperPass, ScalarEvolutionWrapperPass and LoopAccessLegacyAnalysis.<br>
>     Therefore, I implement the following code based on LLVM 9.0.0:<br>
><br>
> =====================================================================<br>
> bool LoopInformationCollect::runOnLoop(Loop *L, LPPassManager &)<br>
> {<br>
><br>
>     auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE();<br>
>     auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();<br>
>     // auto *LAA = &getAnalysis<LoopAccessLegacyAnalysis>();<br>
>     if (Loop_id.find(L)==Loop_id.end()) // traverse instructions in the block assign instruction ID<br>
>     {<br>
>         Loop_id[L] = ++Loop_Counter;<br>
>     }<br>
>     // *Loop_out << "---------------Loop report----------------\n";<br>
>     // *Loop_out << LAA->getInfo(L).getReport();<br>
>     return false;<br>
> }<br>
><br>
> char LoopInformationCollect::ID = 0;<br>
><br>
> void LoopInformationCollect::getAnalysisUsage(AnalysisUsage &AU) const {<br>
>     AU.addRequired<LoopInfoWrapperPass>();<br>
>     AU.addRequired<ScalarEvolutionWrapperPass>();<br>
>     AU.addRequired<LoopAccessLegacyAnalysis>();<br>
>     AU.setPreservesAll();<br>
> }<br>
> =====================================================================<br>
><br>
>    I can make the project with GNU make successfully but get the error "Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized." during runtime. When I remove the line "AU.addRequired<LoopAccessLegacyAnalysis>();" and make the project again,
 I run the program successfully.<br>
><br>
>    Detailed error report is shown below:<br>
><br>
> ---------------------------------------------------------------------------------------------------------<br>
> Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized.<br>
> Verify if there is a pass dependency cycle.<br>
> Required Passes:<br>
>         Natural Loop Information<br>
>         Scalar Evolution Analysis<br>
> ---------------------------------------------------------------------------------------------------------<br>
><br>
>    Please note that I am not using "opt" in the terminal to run the passes but utilize PassManager in a main() function. It seems that the problem is caused by "LoopAccessLegacyAnalysis", since I have not faced this problem with other passes. I am wondering
 how I can fix this situation.<br>
>    Thanks a lot for your time and suggestions!<br>
><br>
> Best regards,<br>
> ------------------------------------------<br>
> Tingyuan LIANG<br>
> MPhil Student<br>
> Department of Electronic and Computer Engineering<br>
> The Hong Kong University of Science and Technology<br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> llvm-dev@lists.llvm.org<br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</div>
</span></font></div>
</body>
</html>