[LLVMdev] Runtime exception in DominatorTree.getRootNode()

John Criswell criswell at illinois.edu
Fri Apr 12 08:03:35 PDT 2013


On 4/12/13 9:51 AM, Bill He wrote:
> Thanks for your reply, John.
>
> I am using opt to run my pass. Should opt by default link in the 
> library? Would you please give me some idea on fixing it? Thanks!

Odd.  I would think that opt would have that pass linked in statically.

I'm not sure why it's not working.  Does anyone else have an idea?

-- John T.

>
> opt -load ../../../Debug+Asserts/lib/LLVMHello.dylib -hello < hello.bc 
> > /dev/null
>
>  My pass is just:
>
> #include "llvm/IR/Function.h"
> #include "llvm/Pass.h"
> #include "llvm/Support/raw_ostream.h"
> #include "llvm/Analysis/Dominators.h"
>
> using namespace llvm;
>
> namespace {
>   struct Hello : public FunctionPass {
>     static char ID;
>     Hello() : FunctionPass(ID) { }
>     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
>       AU.addRequired<DominatorTree>();
>     }
>     virtual bool runOnFunction(Function &F) {
>       DominatorTree& DT = getAnalysis<DominatorTree>();
>       BasicBlock* BB = DT.getRoot();
>       return false;
>     }
>   };
> }
> char Hello::ID = 0;
> static RegisterPass<Hello> Z("hello", "My test analysis", true, true);
>
>
> On Fri, Apr 12, 2013 at 9:32 AM, John Criswell <criswell at illinois.edu 
> <mailto:criswell at illinois.edu>> wrote:
>
>     On 4/11/13 10:30 PM, Bill He wrote:
>>     Hi all,
>>
>>     I am trying to traverse a dominator tree and have encountered a
>>     weird runtime exception:
>>
>>     Here's my simple code:
>>
>>       virtual bool runOnFunction(Function &F) {
>>         DominatorTree& DT = getAnalysis<DominatorTree>();
>>
>>     *    DomTreeNode* rootNode = DT.getRootNode();*
>>         return false.
>>     }
>>
>>     Here's the documentation page:
>>     http://llvm.org/docs/doxygen/html/classllvm_1_1DominatorTree.html
>>
>>     And here's my runtime exception:
>>     dyld: lazy symbol binding failed: Symbol not found:
>>     __ZN4llvm17DominatorTreeBaseINS_10BasicBlockEE11getRootNodeEv
>>       Referenced from:
>>     /Users/weibohe/Projects/llvm/llvm/Debug+Asserts/lib/LLVMSLVN.dylib
>
>     How are you running your pass?  Based on the error, it looks like
>     whatever tool you're using to run your pass doesn't have the
>     library defining the DominatorTree code linked in.
>
>     -- John T.
>
>>       Expected in: flat namespace
>>
>>     dyld: Symbol not found:
>>     __ZN4llvm17DominatorTreeBaseINS_10BasicBlockEE11getRootNodeEv
>>       Referenced from:
>>     /Users/weibohe/Projects/llvm/llvm/Debug+Asserts/lib/LLVMSLVN.dylib
>>       Expected in: flat namespace
>>
>>     0  opt               0x0000000105f528de
>>     llvm::sys::PrintStackTrace(__sFILE*) + 46
>>     1  opt               0x0000000105f52beb
>>     _ZL28PrintStackTraceSignalHandlerPv + 27
>>     2  opt               0x0000000105f52ef9 _ZL13SignalHandleri + 297
>>     3  libsystem_c.dylib 0x00007fff90d32cfa _sigtramp + 26
>>     4  libsystem_c.dylib 0xfffffffffffffff8 _sigtramp + 1865208600
>>     5  libsystem_c.dylib 0x00007fff64a41948 _sigtramp + 3553684584
>>     6  libdyld.dylib     0x00007fff8afe2716 dyld_stub_binder_ + 13
>>     7  LLVMSLVN.dylib    0x00000001081a8040 void
>>     std::__destroy_aux<llvm::PassInfo const**>(llvm::PassInfo
>>     const**, llvm::PassInfo const**, std::__true_type) + 19904
>>     8  LLVMSLVN.dylib    0x00000001081998c1 (anonymous
>>     namespace)::DVN::runOnFunction(llvm::Function&) + 65
>>     9  opt               0x0000000105eb27b2
>>     llvm::FPPassManager::runOnFunction(llvm::Function&) + 434
>>     10 opt               0x0000000105eb2a98
>>     llvm::FPPassManager::runOnModule(llvm::Module&) + 104
>>     11 opt               0x0000000105eb2e9a
>>     llvm::MPPassManager::runOnModule(llvm::Module&) + 634
>>     12 opt               0x0000000105eb36ae
>>     llvm::PassManagerImpl::run(llvm::Module&) + 302
>>     13 opt               0x0000000105eb3951
>>     llvm::PassManager::run(llvm::Module&) + 33
>>     14 opt               0x0000000104e4d335 main + 6549
>>     15 opt               0x0000000104e3e434 start + 52
>>     Stack dump:
>>     0.Program arguments: opt -load
>>     ../../../Debug+Asserts/lib/LLVMSLVN.dylib -dvn
>>     1.Running pass 'Function Pass Manager' on module '<stdin>'.
>>     2.Running pass 'My test analysis' on function '@main'
>>
>>
>>     Any idea on why this is happening? Any help or suggestion is
>>     appreciated! Thanks in advance.
>>
>>     Best,
>>     Weibo
>>
>>
>>
>>     _______________________________________________
>>     LLVM Developers mailing list
>>     LLVMdev at cs.uiuc.edu  <mailto:LLVMdev at cs.uiuc.edu>          http://llvm.cs.uiuc.edu
>>     http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130412/430eb1e0/attachment.html>


More information about the llvm-dev mailing list