<br clear="all">I used LLVM already existent passes with no problems till I tried to use MemDepPrinter.cpp : <a href="http://llvm.org/doxygen/MemDepPrinter_8cpp_source.html">http://llvm.org/doxygen/MemDepPrinter_8cpp_source.html</a> . I got the following segfault:<br>
<br> llvm[0]: Compiling MyMemDepPrinter.cpp for Release+Asserts build (PIC)<br> llvm[0]: Linking Release+Asserts Loadable Module MyMemDepPrinter.so<br> WARNING: You're attempting to print out a bitcode file.<br>
This is inadvisable as it may cause display problems. If<br> you REALLY want to taste LLVM bitcode first-hand, you<br> can force output with the `-f' option.<br> <br> 0 opt 0x08eaf9a8<br> 1 opt 0x08eaff24<br>
2 0xb7753400 __kernel_sigreturn + 0<br> 3 opt 0x08c00c19 llvm::MemoryDependenceAnalysis::getNonLocalPointerDepFromBB(llvm::PHITransAddr const&, llvm::AliasAnalysis::Location const&, bool, llvm::BasicBlock*, llvm::SmallVectorImpl<llvm::NonLocalDepResult>&, llvm::DenseMap<llvm::BasicBlock*, llvm::Value*, llvm::DenseMapInfo<llvm::BasicBlock*> >&, bool) + 3673<br>
4 opt 0x08c019aa llvm::MemoryDependenceAnalysis::getNonLocalPointerDependency(llvm::AliasAnalysis::Location const&, bool, llvm::BasicBlock*, llvm::SmallVectorImpl<llvm::NonLocalDepResult>&) + 266<br>
5 opt 0x08bf1bed<br> 6 opt 0x08e3415c llvm::FPPassManager::runOnFunction(llvm::Function&) + 636<br> 7 opt 0x08e341c8 llvm::FPPassManager::runOnModule(llvm::Module&) + 56<br> 8 opt 0x08e33de4 llvm::MPPassManager::runOnModule(llvm::Module&) + 692<br>
9 opt 0x08e37270 llvm::PassManagerImpl::run(llvm::Module&) + 240<br> 10 opt 0x08e37386 llvm::PassManager::run(llvm::Module&) + 38<br> 11 opt 0x081a290f main + 6095<br> 12 libc.so.6 0xb74604d3 __libc_start_main + 243<br>
13 opt 0x081b8509<br> Stack dump:<br> 0. Program arguments: //home/alex/llvm/Release+Asserts/bin/opt -load //home/alex/llvm/Release+Asserts/lib/MyMemDepPrinter.so -print-memdeps //home/alex/llvm/tools/clang/woRKSPACE/Test.bc <br>
1. Running pass 'Function Pass Manager' on module '//home/alex/llvm/tools/clang/woRKSPACE/Test.bc'.<br> 2. Running pass 'Print MemDeps of function' on function '@_Z9deadcode1i'<br>
./run.sh: line 14: 3326 Segmentation fault (core dumped) //home/alex/llvm/Release+Asserts/bin/opt -load //home/alex/llvm/Release+Asserts/lib/MyMemDepPrinter.so -print-memdeps //home/alex/llvm/tools/clang/woRKSPACE/Test.bc<br>
<br>I got segfaults only for my own passes, but not LLVM's already existent. It is a constraint on the test program that can cause the segfault? Does this pass work for you? I am using it as a parameter for the opt tool.<br>
<br>When I am running it in GDB mode, I get:<br><br> Program received signal SIGSEGV, Segmentation fault.<br> 0x08c00c19 in llvm::MemoryDependenceAnalysis::getNonLocalPointerDepFromBB(llvm::PHITransAddr const&, llvm::AliasAnalysis::Location const&, bool, llvm::BasicBlock*, llvm::SmallVectorImpl<llvm::NonLocalDepResult>&, llvm::DenseMap<llvm::BasicBlock*, llvm::Value*, llvm::DenseMapInfo<llvm::BasicBlock*> >&, bool) ()<br>
(gdb) x/i $pc<br> => 0x8c00c19 <_ZN4llvm24MemoryDependenceAnalysis27getNonLocalPointerDepFromBBERKNS_12PHITransAddrERKNS_13AliasAnalysis8LocationEbPNS_10BasicBlockERNS_15SmallVectorImplINS_17NonLocalDepResultEEERNS_8DenseMapIS9_PNS_5ValueENS_12DenseMapInfoIS9_EEEEb+3673>: mov 0x10(%eax),%eax<br>
<br>Please tell me if you know the problem or the pass works fine for you and if so how you use it. <br><br>Thank you !<br><br><br>