[LLVMdev] Should repetitive basic blocks be removed in the results of LoopBase::getExitBlocks()?
xiaoming gu
xiaoming.gu at gmail.com
Thu Apr 19 22:43:19 PDT 2012
Hi, all. I'm using void LoopBase::getExitBlocks (SmallVectorImpl< BlockT *
> &ExitBlocks) const to get all
exit blocks for a loop. The problem I find with this API is that it returns
repetitive basic blocks in certain
situations. Should repetitive basic blocks be removed?
I have an example to show the problem. Following is the source code and the
CFG is enclosed.
int main()
{
int i = rand()%10;
while ( i < 20 )
{
i++;
if ( i == 5)
return 21;
if ( i == 9)
continue;
else if ( i == 10)
break;
}
return i;
}
If you use getExitBlocks() to get the exit basic blocks for the loop, the
block "10" will show up twice in the
results.
Xiaoming
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120420/a25241fe/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_cfg.pdf
Type: application/pdf
Size: 4013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120420/a25241fe/attachment.pdf>
More information about the llvm-dev
mailing list