problem with llvm pass for call graph & CFG

Hi all,
I wrote a pass (attached). But I get a runtime error:

buse@buse-VB:~/Desktop/llvm-2.7/lib/Transforms/CG_CFG$ opt-2.7 -load …/…/…/Release/lib/ -CG_CFGGen < …/…/…/buse/simpleCode.bc > /dev/null
0 0x00007f4a8b6add1f
1 0x00007f4a8b6ae36d
2 0x00007f4a8aa98b40
3 0x00007f4a8995891f
4 0x00007f4a8b329608 llvm::MPPassManager::runOnModule(llvm::Module&) + 376
5 0x00007f4a8b32972b llvm::PassManagerImpl::run(llvm::Module&) + 107
6 opt-2.7 0x0000000000415df3 main + 2035
7 0x00007f4a89b79d8e __libc_start_main + 254
8 opt-2.7 0x0000000000409569
Stack dump:
0. Program arguments: opt-2.7 -load …/…/…/Release/lib/ -CG_CFGGen

  1. Running pass ‘Unnamed pass: implement Pass::getPassName()’ on module ‘’.
    Segmentation fault

I couldn’t diagnose the problem. Any ideas?

CG_CFGGen.cpp (2 KB)

Hi all,
I wrote a pass (attached). But I get a runtime error:

It looks like you’re using a Release build of LLVM. I recommend compiling LLVM and your pass in a Debug build; that will generate asserts and provide source line information so that you can more easily debug the problem.

I don’t have time to look at your code in detail (and chances are good that nobody else on the list does, either), but if I had to guess, you’re probably assuming that a value is always non-NULL when it can be NULL. I’d double check that F and other critical values are non-NULL by adding assert statements.

– John T.