On Tue, Dec 11, 2012 at 1:01 AM, Sebastian Redl < [email protected]> 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.
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
