<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><div dir="ltr">On Tue, Dec 11, 2012 at 1:01 AM, Sebastian Redl <span dir="ltr"><<a href="mailto:sebastian.redl@getdesigned.at" target="_blank">sebastian.redl@getdesigned.at</a>></span> wrote:<br>
<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 11.12.2012 08:06, Duncan Sands wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Saleem, why do you want this?  While isPowerOfTwo doesn't use data layout<br>
today, it's not unreasonable to imagine that it may use it one day.  As such,<br>
requiring target data can be considered part of the isPowerOfTwo API.<br>
</blockquote></div>
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.</blockquote>
<div><br></div><div style>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?</div><div style>
<br></div><div style>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.</div>
</div></div></div></div>