[cfe-commits] [PATCH] Simplify isPowerOfTwo signature
Chandler Carruth
chandlerc at google.com
Tue Dec 11 01:54:17 PST 2012
On Tue, Dec 11, 2012 at 1:01 AM, Sebastian Redl <
sebastian.redl at getdesigned.at> wrote:
> On 11.12.2012 08:06, Duncan Sands wrote:
>
>> Hi Saleem, why do you want this? While isPowerOfTwo doesn't use data
>> layout
>> today, it's not unreasonable to imagine that it may use it one day. As
>> such,
>> requiring target data can be considered part of the isPowerOfTwo API.
>>
> Without knowing anything about the specific use case of this function, my
> intuition is that "is power of two" is a purely mathematical property, and
> if it's influenced by TargetData, something is wrong.
The number of bits in a pointer's address might impact the determination of
isPowerOfTwo, no? How about the offsets applied to a pointer via a GEP
through a structure with padding?
This isn't about the mathematical test necessarily so much as analyzing the
evident constraints on a value in the IR based on its uses and def-chain.
It might be important to know the size of pointers or the offsets produced
by a GEP in determining these.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121211/1c6ce4a5/attachment.html>
More information about the cfe-commits
mailing list