[LLVMdev] Small problem in BitVector.h
clattner at apple.com
Fri Jan 23 10:17:45 CST 2009
On Jan 23, 2009, at 6:43 AM, heisenbug wrote:
> On Jan 23, 1:51 pm, Roman Levenstein <romix.l... at googlemail.com>
>> Doing some profiling of llc, I noticed that some bitvector operations
>> took longer than usual. Then I noticed that too many copies of
>> BitVector obejcts are created, even when such operations like &=, ^=,
>> |= are performed on those bit vectors.
>> I looked at the BitVector ADT implementation in BitVector.h and
>> figured out that all assignment operations (except the usual
>> assignment operator) return a copy of the bit vector, instead of a
>> I guess it was just overlooked.
>> Below is the patch to fix it. Is it OK to commit?
> Yes. Please note in the commit message that the old
> semantics probably did not meet the expectations.
> With your patch, chained assignments happen to the right
Yes, please apply!
> A very good catch, and a nice demonstration of how
> C++'s performance characteristics can be spoiled
> by small bugs like these.
Too much subtlety :(
More information about the LLVMdev