Code Extractor Issue

I’m having an issue with the CodeExtractor. When I try to extract the lone basic block from the following function, I get an assertion error.

define i32 @test(i32 %x) {
%tmp = call i32 @test3( i32 %x ) ; [#uses=1]
ret i32 %tmp

The assertion error is:

lli: Dominators.cpp:71: void llvm::DominatorTree::splitBlock(llvm::BasicBlock*): Assertion `NewBB->getTerminator()->getNumSuccessors() == 1 && “NewBB should have a single successor!”’ failed.
lli((anonymous namespace)::PrintStackTrace()+0x22)[0x87f7cb8]
lli((anonymous namespace)::SignalHandler(int)+0x110)[0x87f7f7c]
lli(llvm::ExtractCodeRegion(llvm::DominatorTree&, std::vector<llvm::BasicBlock*, std::allocatorllvm::BasicBlock* > const&, bool)+0x39)[0x86b321d]

I just updated to llvm-2.1 from llvm-1.9 where I was never having this problem. I don’t understand exactly what it’s complaining about (maybe the fact that the terminator instruction is a ‘ret’ instruction?, but I don’t see why it couldn’t handle this kind of a block).

Ben Mayne

Please file a bug. Thanks.