[PATCH] Passing down BinaryOperator flags to BinarySDNode + X86 optimization

Pete Cooper peter_cooper at apple.com
Fri May 30 10:04:25 PDT 2014


On May 30, 2014, at 9:31 AM, Marcello Maggioni <hayarms at gmail.com> wrote:

> 
> 
> 
> 2014-05-30 8:01 GMT-07:00 Marcello Maggioni <hayarms at gmail.com>:
> >
> >
> >
> >
> > 2014-05-29 23:08 GMT-07:00 Pete Cooper <peter_cooper at apple.com>:
> >
> >> Hi Marcello
> >>
> >> This is great.  Thanks for working on this.
> >>
> >> So the first patch "flag_nodes.patch” contains quite a bit of code cleanup.  Its all good cleanup, but as there’s quite a lot of it can you please separate it out and rebase the other patches on top of the cleanup work.
> >>
> >> The * here is a neat trick, but not really valid for a bool.  Would && work the same?
> >>
> >> +    SubclassData = 
> >> +      (SubclassData & ~NUW) | (b * NUW);
> >>
> >
> > Hmm, I have to admit I copied this from the approach used in the Operator.h:89 for the "OverflowingBinaryOperator" class.
> >
> > I thought it was strange, but I assumed it worked because it was there. Maybe would be a good idea to change it everywhere? (in two separate patches)
> >  
> 
> 
> More on this.
> 
> I think this should work because in the C++ standard I found:
> 
>  §4.7/4  (Integral Conversion):
> 
> If the source type is bool, the value false is converted to zero and the value true is converted to one.
> 
> 
> So ideally "true" is converted to 1 for the multiplication and (1 * FLAG) == FLAG.
> 
>   (SubclassData & ~NUW) | (b && NUW); 
> I don't think would work (if that is what you meant).
> 
> Otherwise there is the more standard:
> (SubclassData & ~NUW) | (b ? NUW : 0); 
Ah cool, no worries then.  That you are already doing the same as OverflowingBinaryOperator is also good.

Thanks,
Pete
> 
> Marcello

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140530/31a081fb/attachment.html>


More information about the llvm-commits mailing list