Andrew Trick
2012-Apr-24 05:39 UTC
[LLVMdev] Should repetitive basic blocks be removed in the results of LoopBase::getExitBlocks()?
On Apr 23, 2012, at 10:31 PM, Andrew Trick <atrick at apple.com> wrote:> > On Apr 19, 2012, at 10:43 PM, xiaoming gu <xiaoming.gu at gmail.com> wrote: > >> 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? > > Users generally expect a unique set of exit blocks, but don't make any strong assumption. The worst that can happen is missed optimization or redundant analysis. In most cases, the loop is in LoopSimplifyForm, so it's probably not a problem in practice.Another thing I should mention. The iteration order of ExitBlocks is important. In llvm, generating unique sets is a pain because values are not numbered and iteration order needs to be reproducible. We would need to keep a SmallPtrSet for membership checking while populating the result vector. -Andy -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120423/74bcabc8/attachment.html>
Hongbin Zheng
2012-Apr-24 06:22 UTC
[LLVMdev] Should repetitive basic blocks be removed in the results of LoopBase::getExitBlocks()?
hi,> Users generally expect a unique set of exit blocks, but don't make any > strong assumption. The worst that can happen is missed optimization or > redundant analysis. In most cases, the loop is in LoopSimplifyForm, so it's > probably not a problem in practice. > > > Another thing I should mention. The iteration order of ExitBlocks is > important. In llvm, generating unique sets is a pain because values are not > numbered and iteration order needs to be reproducible. We would need to keep > a SmallPtrSet for membership checking while populating the result vector.What about use the SetVector[1] as container? As its comment say: This adapter class provides a way to keep a set of things that also has the property of a deterministic iteration order. The order of iteration is the order of insertion. best regards ether [1]http://www.llvm.org/doxygen/classllvm_1_1SetVector.html> > -Andy > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Andrew Trick
2012-Apr-24 15:53 UTC
[LLVMdev] Should repetitive basic blocks be removed in the results of LoopBase::getExitBlocks()?
On Apr 23, 2012, at 11:22 PM, Hongbin Zheng <etherzhhb at gmail.com> wrote:> hi, > > >> Users generally expect a unique set of exit blocks, but don't make any >> strong assumption. The worst that can happen is missed optimization or >> redundant analysis. In most cases, the loop is in LoopSimplifyForm, so it's >> probably not a problem in practice. >> >> >> Another thing I should mention. The iteration order of ExitBlocks is >> important. In llvm, generating unique sets is a pain because values are not >> numbered and iteration order needs to be reproducible. We would need to keep >> a SmallPtrSet for membership checking while populating the result vector. > What about use the SetVector[1] as container? As its comment say: > > This adapter class provides a way to keep a set of things that also > has the property of a deterministic iteration order. The order of > iteration is the order of insertion.Sure, you can wrap the SmallPtrSet within the SetVector. You need to change the API then. -Andy
Maybe Matching Threads
- [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] Should repetitive basic blocks be removed in the results of LoopBase::getExitBlocks()?
- [LLVMdev] [PATCH] Fix nondeterministic behaviour in the CodeExtractor
- [LLVMdev] [PATCH] Fix nondeterministic behaviour in the CodeExtractor