Extract Loop Failing

I am trying to use ExtractLoop() but I am getting segFaults:

0 opt 0x00000000008edc2f
1 opt 0x00000000008edfda
2 libpthread.so.0 0x00007ffe21203c60
3 opt 0x0000000000895ed9 llvm::Value::getName() const + 9
4 LLVMEXITCDFG.so 0x00007ffe202b80d7
5 opt 0x00000000006fc6e7 llvm::LPPassManager::runOnFunction(llvm::Function&) + 1143
6 opt 0x0000000000882557 llvm::FPPassManager::runOnFunction(llvm::Function&) + 551
7 opt 0x00000000008825db llvm::FPPassManager::runOnModule(llvm::Module&) + 75
8 opt 0x0000000000882197 llvm::MPPassManager::runOnModule(llvm::Module&) + 503
9 opt 0x0000000000882299 llvm::PassManagerImpl::run(llvm::Module&) + 137
10 opt 0x00000000004ac451 main + 4881
11 libc.so.6 0x00007ffe204d9eff __libc_start_main + 255
12 opt 0x000000000049f5f9
Stack dump:
0. Program arguments: opt -load /home/ryan/llvm/llvm_core/llvm-2.9/Release/lib/LLVMEXITCDFG.so -exitPass fix_fft.c.bc -o fix_fft.c.bc

  1. Running pass ‘Function Pass Manager’ on module ‘fix_fft.c.bc’.
  2. Running pass ‘Loop Pass Manager’ on function ‘@fix_fft
  3. Running pass ‘CDFG exitPass’ on basic block ‘%bb3’
    ./optScript.sh: line 46: 2637 Segmentation fault opt -load /home/ryan/llvm/llvm_core/llvm-2.9/Release/lib/LLVMEXITCDFG.so -exitPass $1.bc -o ${1}.bc

If I remove the “deleteLoopFromQueue” function call, it goes over all the loops (supposedly extracting them) and then segFaults.

How should I properly use this function?

Is it not a good idea to try and extract loops that have multiple exits?

It looks like this problem only exists on nested loops, ideas?

Filing a bug with a test case would be a good start.

Cameron

I’m not sure it’s a bug. If I don’t know if I am properly using it then how would I know it’s a bug and not simply a user issue? If it sounds like a bug to you then I will file it. :slight_smile:

How do you expect people to be able to tell you if you are using it properly if they can’t see how you are using it?

Cameron

if (shouldExtractLoop) {
if (ExtractLoop(DT, L, AggregateArgs) != 0) {
errs()<<“Extracting, now deleting loop from queue\n”;
Changed = true;
if (L->getParentLoop()) {
LPM.deleteLoopFromQueue(L);
}
errs()<<“Extracting Loop “<getHeader()->getName().str()<<”\n”;
}
}