[LLVMdev] getExitBlocks returns duplicates in result vector

Harmen van der Spek hvdspek at liacs.nl
Fri Nov 20 02:11:31 PST 2009


Hi,

LoopBase::getExitBlocks in LoopInfo.h returns all exit basic blocks by 
iterating over all blocks of a loop and storing all branch targets
that are outside the loop. This method allows for duplicates in the
result vector, e.g.:

Loop at depth 2 containing: %bb2<header><exit>,%bb1<latch>,%bb3<exit>

where both bb2 and bb3 have bb4 as their exit block.

This loop corresponds to the following common pattern found in C code:
while( c1 <bb2> && c2 <bb3> )
	bb1;
bb4;

In this case, bb4 occurs twice in the result vector. Is this behavior
intended, or should duplicates be avoided.

Harmen




More information about the llvm-dev mailing list