[cfe-commits] [pr12251][patch] Use i1* for boolean loads and stores

Sandeep Patel deeppatel1987 at gmail.com
Tue Mar 13 18:01:50 PDT 2012

2012/3/13 Chris Lattner <clattner at apple.com>:
> On Mar 13, 2012, at 1:21 PM, Rafael Espíndola wrote:
>>> the language ref currently says that it is undefined what gets stored in the
>>> other 7 bits when you write an i1.  That was just to give freedom to be
>>> efficient, but should be changed to say "target dependent" or something like
>>> that if you want to go this way.
>> Good point. I noticed the store had to be i1 for the i1 load to be
>> legal, but I missed this one.
> I really don't like "store of i1" having target-dependent semantics.  If the real issue here is that we have no way to represent a "byte load that is known to be all ones at the top part" then we should add support for that directly IMO.
> Doing this should be relatively straightforward: just add a per-instruction metadata that indicates the number of leading zero bits that ComputeMaskedBits and friends can use.  The hard part is designing something that is suitably general to capture other interesting properties.

Just thinking out loud here --

Isn't this what metadata is for? Shouldn't we encode known value-range
limits as metadata and just attach it in the proper places? That might
lead nicely to future value-range optimization work.


More information about the cfe-commits mailing list