[llvm-commits] CVS: llvm/include/llvm/DerivedTypes.h
Chris Lattner
clattner at apple.com
Sun Mar 4 16:05:27 PST 2007
>> + /// getSignBit - Return a uint64_t with just the most
>> significant bit set (the
>> + /// sign bit, if the value is treated as a signed number).
>> + uint64_t getSignBit() const {
>> + return 1ULL << (getBitWidth()-1);
>> + }
>> +
>
> I'm trying to get rid of such functions and you're adding more of
> them :)
The thought occurred to me :). However, this is used in
InstCombiner::SimplifyDemandedBits, which will require significant
work to APInt'ify. Using a function like this (instead of localized
bit-twiddling) will at least help distill the intention out of the code.
> Please note that in many places (like the place you intend to use
> getSignBit), it may be necessary to use APInt::getSignedMinValue() for
> this value to enable it to work with > 64 bits. The exception to
> this is
> GEP indexing which are known to be 32/64 bit indices. If your use is
> similar, I suppose this is fine. If not, please note that when
> InstructionCombining is done (Sheng's working on it), I intend to pass
> through LLVM and get rid of calls to both of these functions, if
> appropriate.
I strongly encourage Sheng to do instcombine one piece at a time: say
visitAND, then visitOR (etc) and submit them as separate patches.
Blasting me with one huge patch is not going to earn brownie points,
and if/when it breaks something, it won't be easy to track down what
part of the huge change did it.
-Chris
More information about the llvm-commits
mailing list