poolalloc crashed at PA::Heuristic::getLocalPoolNodes

Hi Fellows,

I tried to build and execute the poolalloc transformation on a simple C program, but I got the following error. My poolalloc is git-cloned from https://github.com/llvm-mirror/poolalloc (a LLVM 3.3 compatible repo). Any thoughts on how to fix it?

PV@PV-h8-1280t:~/LLVM/llvm-3.3.src/projects/poolalloc$ opt -S -load ./Debug+Asserts/lib/LLVMDataStructure.so -load ./Debug+Asserts/lib/poolalloc.so -poolalloc < test.ll
Pool allocating 0 global nodes!
0 opt 0x00000000017381de llvm::sys::PrintStackTrace(_IO_FILE*) + 46
1 opt 0x000000000173849b
2 opt 0x000000000173870e
3 libpthread.so.0 0x00007f6f5d570cb0
4 poolalloc.so 0x00007f6f5bf73cbf llvm::PA::Heuristic::getLocalPoolNodes(llvm::Function const&, std::vector<llvm::DSNode const*, std::allocator<llvm::DSNode const*> >&) + 31
5 poolalloc.so 0x00007f6f5bfb8279 llvm::PoolAllocate::ProcessFunctionBody(llvm::Function&, llvm::Function&) + 633
6 poolalloc.so 0x00007f6f5bfb5b80 llvm::PoolAllocate::runOnModule(llvm::Module&) + 1312
7 opt 0x00000000016ad00a llvm::MPPassManager::runOnModule(llvm::Module&) + 634
8 opt 0x00000000016ad7be llvm::PassManagerImpl::run(llvm::Module&) + 302
9 opt 0x00000000016ada11 llvm::PassManager::run(llvm::Module&) + 33
10 opt 0x000000000063e5c1 main + 6609
11 libc.so.6 0x00007f6f5c5a076d __libc_start_main + 237
12 opt 0x000000000062fb75
Stack dump:
0. Program arguments: opt -S -load ./Debug+Asserts/lib/LLVMDataStructure.so -load ./Debug+Asserts/lib/poolalloc.so -poolalloc

  1. Running pass ‘Pool allocate disjoint data structures’ on module ‘’.
    drive_all.sh: line 3: 5947 Segmentation fault (core dumped) opt -S -load ./Debug+Asserts/lib/LLVMDataStructure.so -load ./Debug+Asserts/lib/poolalloc.so -poolalloc < test.ll

P.S. The input C program is the program listed in Figure 1 of Chris Lattner’s PLDI 2005 paper.

Best,

Paul

First, I’m not sure if we ever completed the port of poolalloc to LLVM 3.3. You might want to try the release_32 branch of poolalloc and see if that works better. Second, the poolalloc transform has probably experienced some bit-rot over the past few years as we don’t actively use it in the SAFECode compiler by default, so I’m not sure how robust it is anymore. You might want to take a look at Daniel Huang’s paper (if you have online access to Springer papers); he might have used the poolalloc code for his project: John Criswell