[llvm-commits] [llvm] r149810 - /llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp

David Blaikie dblaikie at gmail.com
Sat Feb 4 22:41:02 PST 2012


On Sat, Feb 4, 2012 at 10:28 PM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
> 2012/2/5 David Blaikie <dblaikie at gmail.com>:
>>> BBVectorize.cpp: Get rid of comparision to bool to fix a warning.
>>>
>>> Modified:
>>>    llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp
>>
>>> -        if (CurrentPairs.count(C->second) > 0 &&
>>> +        if (CurrentPairs.count(C->second) != 0 &&
>>
>> Could you explain this? if count returns bool - perhaps dropping the "
>> != 0" entirely would be better? It seems like "!= 0" is equally
>> misleading (& still a comparison to bool, really) as "> 0" was.
>
> I thought then, the clause already had the expression
> "Visited.count(C->second) == 0", and I followed it. ;)

Ah, I see - that is a good point. But (after excessive rambling (on my
part) discussion on IRC) I think we decided that using count's return
as boolean for 'contains' tests is fairly idiomatic at this point.

> Feel free to paint our bikeshed!

r149813

Thanks,
- David




More information about the llvm-commits mailing list