Hi all, I was able to create a pass following [1]. Now goal is amend the pass and try to dump the call graph. I think I have properly amended the source extending my pass from CallGraphSCCPass but unfortunately every time I run it, it crashes. I tried with llvm-6 and llvm-7. I notice that if I change EP_EarlyAsPossible to anything else it does not crash but I don't see the expected string printed by the runOnSCC. Could you help me to solve this problem? How should I create the pass? Thanks for your time [1] https://www.cs.cornell.edu/~asampson/blog/llvm.html -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181116/c779a50d/attachment.html>
There’s two things going on here: Firstly, extension points interact in a slightly odd way with optimization levels: * At -O0 the only extension points used are EP_EarlyAsPossible and EP_EnabledOnOptLevel0 * At -O1 and higher all extension points are used except EP_EnabledOnOptLevel0 so when you’re not seeing the crash it’s because you’re using an optimization level (probably -O0 because that’s the default) where the extension point you’re using isn’t used. Secondly, CGSCC passes can only be added to a GCSCC pass manager. If you use a debug build of clang then the crash becomes an assertion failure which (somewhat) tells you this: CallGraphSCCPass.cpp:575: virtual void llvm::CallGraphSCCPass::assignPassManager(llvm::PMStack&, llvm::PassManagerType): Assertion `!PMS.empty() && "Unable to handle Call Graph Pass"' failed. From some experimentation it looks like it’s only EP_EarlyAsPossible where we get this error, because (looking at PassManagerBuilder::populateFunctionPassManager) that extension point uses a Function Pass Manager whereas all the others look like they use a Module Pass Manager. John From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Alberto Barbaro via llvm-dev Sent: 16 November 2018 18:34 To: llvm-dev at lists.llvm.org Subject: [llvm-dev] Help with a pass Hi all, I was able to create a pass following [1]. Now goal is amend the pass and try to dump the call graph. I think I have properly amended the source extending my pass from CallGraphSCCPass but unfortunately every time I run it, it crashes. I tried with llvm-6 and llvm-7. I notice that if I change EP_EarlyAsPossible to anything else it does not crash but I don't see the expected string printed by the runOnSCC. Could you help me to solve this problem? How should I create the pass? Thanks for your time [1] https://www.cs.cornell.edu/~asampson/blog/llvm.html -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181120/71f25222/attachment.html>
Thanks John, All clear now. Is it worthy to open a bug issue? Thanks On Tue, Nov 20, 2018, 14:59 John Brawn <John.Brawn at arm.com wrote:> There’s two things going on here: > > > > Firstly, extension points interact in a slightly odd way with optimization > levels: > > * At -O0 the only extension points used are EP_EarlyAsPossible and > EP_EnabledOnOptLevel0 > > * At -O1 and higher all extension points are used *except* > EP_EnabledOnOptLevel0 > > so when you’re not seeing the crash it’s because you’re using an > optimization level (probably -O0 because that’s > > the default) where the extension point you’re using isn’t used. > > > > Secondly, CGSCC passes can only be added to a GCSCC pass manager. If you > use a debug build of clang then the > > crash becomes an assertion failure which (somewhat) tells you this: > > CallGraphSCCPass.cpp:575: virtual void > llvm::CallGraphSCCPass::assignPassManager(llvm::PMStack&, > llvm::PassManagerType): Assertion `!PMS.empty() && "Unable to handle Call > Graph Pass"' failed. > > From some experimentation it looks like it’s only EP_EarlyAsPossible where > we get this error, because (looking > > at PassManagerBuilder::populateFunctionPassManager) that extension point > uses a Function Pass Manager > > whereas all the others look like they use a Module Pass Manager. > > > > John > > > > *From:* llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] *On Behalf Of *Alberto > Barbaro via llvm-dev > *Sent:* 16 November 2018 18:34 > *To:* llvm-dev at lists.llvm.org > *Subject:* [llvm-dev] Help with a pass > > > > Hi all, > > I was able to create a pass following [1]. Now goal is amend the pass and > try to dump the call graph. I think I have properly amended the source > extending my pass from CallGraphSCCPass but unfortunately every time I run > it, it crashes. I tried with llvm-6 and llvm-7. I notice that if I change > EP_EarlyAsPossible to anything else it does not crash but I don't see the > expected string printed by the runOnSCC. > > > > Could you help me to solve this problem? How should I create the pass? > > > > Thanks for your time > > > > [1] https://www.cs.cornell.edu/~asampson/blog/llvm.html >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181120/42e84693/attachment.html>
Apparently Analagous Threads
- ModulePass cannot be registered as EarlyAsPossible
- [LLVMdev] vmjc and CallGraphSCCPass
- [LLVMdev] Function::getName in CallGraphSCCPass causes bus error
- [LLVMdev] Fwd: Problem getting LoopInfo inside non-LoopPass
- [LLVMdev] Fwd: Problem getting LoopInfo inside non-LoopPass