Harmen van der Spek
2009-Nov-20 10:11 UTC
[LLVMdev] getExitBlocks returns duplicates in result vector
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
Devang Patel
2009-Nov-20 17:32 UTC
[LLVMdev] getExitBlocks returns duplicates in result vector
On Fri, Nov 20, 2009 at 2:11 AM, Harmen van der Spek <hvdspek at liacs.nl> wrote:> 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,Yes. Try LoopInfo::getUniqueExitBlocks() if you'd like to avoid duplicates. - Devang
Possibly Parallel Threads
- [LLVMdev] DSA nodes do not get merged
- [LLVMdev] Should repetitive basic blocks be removed in the results of LoopBase::getExitBlocks()?
- [LLVMdev] Should repetitive basic blocks be removed in the results of LoopBase::getExitBlocks()?
- [LLVMdev] Getting the DSNode from a Pool Descriptor?
- [LLVMdev] Getting the DSNode from a Pool Descriptor?