[LLVMdev] Should repetitive basic blocks be removed in the results of LoopBase::getExitBlocks()?
Andrew Trick
atrick at apple.com
Tue Apr 24 08:53:24 PDT 2012
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
More information about the llvm-dev
mailing list