(original) (raw)
Dear Michael,
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.
I tried your solution for the pass but got the following compilation error ----> namespace "llvm" has no member "initializeLoopInformationCollectPass".
Such error is raised from the macro define: INITIALIZE\_PASS\_END. Does it mean I need to specially define such function in the LLVM namespace?
Thanks again for your time and patience!
Best regards,
------------------------------------------
Tingyuan LIANG
MPhil Student
Department of Electronic and Computer Engineering
The Hong Kong University of Science and Technology
From: Michael Kruse
Sent: Saturday, February 2, 2019 6:10 AM
To: Tingyuan LIANG
Cc: llvm-dev@lists.llvm.org
Subject: Re: \[llvm-dev\] Confusing ERROR with LoopAccessLegacyAnalysis: Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized.
Sent: Saturday, February 2, 2019 6:10 AM
To: Tingyuan LIANG
Cc: llvm-dev@lists.llvm.org
Subject: Re: \[llvm-dev\] Confusing ERROR with LoopAccessLegacyAnalysis: Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized.
Hi,
you will have to call
initializeLoopAccessLegacyAnalysisPass(\*PassRegistry::getPassRegistry())
before you can use it as a pass dependency. This is usually done by a
sequence of
INITIALIZE\_PASS\_BEGIN(YourPass, "your\_pass", "Your Pass Name", false, false)
INITIALIZE\_PASS\_DEPENDENCY(LoopAccessLegacyAnalysis)
INITIALIZE\_PASS\_END(YourPass, "your\_pass", "Your Pass Name", false, false)
which also creates an initializer for your pass:
initializeYourPassPass which you should call in some way in your
application.
Michael
Am Fr., 1\. Feb. 2019 um 12:58 Uhr schrieb Tingyuan LIANG via llvm-dev
:
\>
\> Dear all,
\>
\> I write a new LoopPass which wants to use passes including LoopInfoWrapperPass, ScalarEvolutionWrapperPass and LoopAccessLegacyAnalysis.
\> Therefore, I implement the following code based on LLVM 9.0.0:
\>
\> =====================================================================
\> bool LoopInformationCollect::runOnLoop(Loop \*L, LPPassManager &)
\> {
\>
\> auto &SE = getAnalysis().getSE();
\> auto &LI = getAnalysis().getLoopInfo();
\> // auto \*LAA = &getAnalysis();
\> if (Loop\_id.find(L)==Loop\_id.end()) // traverse instructions in the block assign instruction ID
\> {
\> Loop\_id\[L\] = ++Loop\_Counter;
\> }
\> // \*Loop\_out << "---------------Loop report----------------\\n";
\> // \*Loop\_out << LAA->getInfo(L).getReport();
\> return false;
\> }
\>
\> char LoopInformationCollect::ID = 0;
\>
\> void LoopInformationCollect::getAnalysisUsage(AnalysisUsage &AU) const {
\> AU.addRequired();
\> AU.addRequired();
\> AU.addRequired();
\> AU.setPreservesAll();
\> }
\> =====================================================================
\>
\> 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();" and make the project again, I run the program successfully.
\>
\> Detailed error report is shown below:
\>
\> ---------------------------------------------------------------------------------------------------------
\> Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized.
\> Verify if there is a pass dependency cycle.
\> Required Passes:
\> Natural Loop Information
\> Scalar Evolution Analysis
\> ---------------------------------------------------------------------------------------------------------
\>
\> 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.
\> Thanks a lot for your time and suggestions!
\>
\> Best regards,
\> ------------------------------------------
\> Tingyuan LIANG
\> MPhil Student
\> Department of Electronic and Computer Engineering
\> The Hong Kong University of Science and Technology
\> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\> LLVM Developers mailing list
\> llvm-dev@lists.llvm.org
\> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
you will have to call
initializeLoopAccessLegacyAnalysisPass(\*PassRegistry::getPassRegistry())
before you can use it as a pass dependency. This is usually done by a
sequence of
INITIALIZE\_PASS\_BEGIN(YourPass, "your\_pass", "Your Pass Name", false, false)
INITIALIZE\_PASS\_DEPENDENCY(LoopAccessLegacyAnalysis)
INITIALIZE\_PASS\_END(YourPass, "your\_pass", "Your Pass Name", false, false)
which also creates an initializer for your pass:
initializeYourPassPass which you should call in some way in your
application.
Michael
Am Fr., 1\. Feb. 2019 um 12:58 Uhr schrieb Tingyuan LIANG via llvm-dev
:
\>
\> Dear all,
\>
\> I write a new LoopPass which wants to use passes including LoopInfoWrapperPass, ScalarEvolutionWrapperPass and LoopAccessLegacyAnalysis.
\> Therefore, I implement the following code based on LLVM 9.0.0:
\>
\> =====================================================================
\> bool LoopInformationCollect::runOnLoop(Loop \*L, LPPassManager &)
\> {
\>
\> auto &SE = getAnalysis().getSE();
\> auto &LI = getAnalysis().getLoopInfo();
\> // auto \*LAA = &getAnalysis();
\> if (Loop\_id.find(L)==Loop\_id.end()) // traverse instructions in the block assign instruction ID
\> {
\> Loop\_id\[L\] = ++Loop\_Counter;
\> }
\> // \*Loop\_out << "---------------Loop report----------------\\n";
\> // \*Loop\_out << LAA->getInfo(L).getReport();
\> return false;
\> }
\>
\> char LoopInformationCollect::ID = 0;
\>
\> void LoopInformationCollect::getAnalysisUsage(AnalysisUsage &AU) const {
\> AU.addRequired();
\> AU.addRequired();
\> AU.addRequired();
\> AU.setPreservesAll();
\> }
\> =====================================================================
\>
\> 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();" and make the project again, I run the program successfully.
\>
\> Detailed error report is shown below:
\>
\> ---------------------------------------------------------------------------------------------------------
\> Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized.
\> Verify if there is a pass dependency cycle.
\> Required Passes:
\> Natural Loop Information
\> Scalar Evolution Analysis
\> ---------------------------------------------------------------------------------------------------------
\>
\> 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.
\> Thanks a lot for your time and suggestions!
\>
\> Best regards,
\> ------------------------------------------
\> Tingyuan LIANG
\> MPhil Student
\> Department of Electronic and Computer Engineering
\> The Hong Kong University of Science and Technology
\> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\> LLVM Developers mailing list
\> llvm-dev@lists.llvm.org
\> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev