<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 1, 2014 at 5:10 PM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">----- Original Message -----<br>
> From: "Alexey Bataev" <<a href="mailto:a.bataev@hotmail.com">a.bataev@hotmail.com</a>><br>
</span><span class="">> To: "Richard Smith" <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>><br>
> Cc: "cfe commits" <<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a>>, "aaron ballman" <<a href="mailto:aaron.ballman@gmail.com">aaron.ballman@gmail.com</a>>, "Michael Spencer"<br>
> <<a href="mailto:bigcheesegs@gmail.com">bigcheesegs@gmail.com</a>>, <a href="mailto:reviews%2Bd4635%2Bpublic%2Bb7e82bdc1d8c324a@reviews.llvm.org">reviews+d4635+public+b7e82bdc1d8c324a@reviews.llvm.org</a>, "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>><br>
> Sent: Tuesday, September 30, 2014 5:03:00 AM<br>
> Subject: Re: [PATCH] align_value attribute in Clang<br>
><br>
</span><span class="">> Hi Richard,<br>
> your guess is correct, it is applied to the outer pointer.<br>
<br>
</span>Okay, in that case if we keep it out of the type system, then I suppose the current patch is essentially okay. The optimizer will deduce the alignment information when it can (especially after inlining), but if it is not a separate type, then we actually can't have it follow template deduction otherwise because it can't affect the mangling. Sound right?<br></blockquote><div><br></div><div>Yes, sounds right to me.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 -Hal<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> Best regards,<br>
> Alexey Bataev<br>
> =============<br>
> Software Engineer<br>
> Intel Compiler Team<br>
><br>
> 30.09.2014 4:50, Richard Smith пишет:<br>
> > On Mon, Sep 29, 2014 at 11:36 AM, Hal Finkel <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a><br>
> > <mailto:<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>>> wrote:<br>
> ><br>
> >     Hi Richard,<br>
> ><br>
> >     What does all of this suggest to you about the right design?<br>
> ><br>
> ><br>
> > One more question. Given:<br>
> ><br>
> >   typedef int * __attribute__((align_value(32))) *Y;<br>
> ><br>
> > ... does the attribute apply to the outer pointer or the inner<br>
> > pointer? (My guess: it surprisingly applies to the outer pointer.)<br>
> > If<br>
> > that's the case, then I think align_value should live entirely<br>
> > outside<br>
> > the type system, in the same way that __attribute__((aligned))<br>
> > does.<br>
> > Note that, given:<br>
> ><br>
> >   typedef int __attribute__((aligned(64))) *p<br>
> >   __attribute__((aligned(8)))<br>
> ><br>
> > p is a 64-byte-aligned pointer to int, not an 8-byte-aligned<br>
> > pointer<br>
> > to a 64-byte-aligned int.<br>
> ><br>
> > If that's the case, I suggest you model it exactly like AlignedAttr<br>
> > --<br>
> > as an attribute on the TypedefDecl -- and look for it explicitly in<br>
> > the cases where you want to use it by walking the type sugar and<br>
> > looking for a TypedefDecl.<br>
> ><br>
> >     FWIW, maybe creating some kind of synthetic typedef type for<br>
> >     the<br>
> >     return value from DeduceTemplateArgumentsByTypeMatch would<br>
> >     work?<br>
> ><br>
> >     Thanks again,<br>
> >     Hal<br>
> ><br>
> >     ----- Original Message -----<br>
> >     > From: "Alexey Bataev" <<a href="mailto:a.bataev@hotmail.com">a.bataev@hotmail.com</a><br>
> >     <mailto:<a href="mailto:a.bataev@hotmail.com">a.bataev@hotmail.com</a>>><br>
> >     > To: "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a> <mailto:<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>>>,<br>
> >     <a href="mailto:reviews%2BD4635%2Bpublic%2Bb7e82bdc1d8c324a@reviews.llvm.org">reviews+D4635+public+b7e82bdc1d8c324a@reviews.llvm.org</a><br>
> >     <mailto:<a href="mailto:reviews%252BD4635%252Bpublic%252Bb7e82bdc1d8c324a@reviews.llvm.org">reviews%2BD4635%2Bpublic%2Bb7e82bdc1d8c324a@reviews.llvm.org</a>><br>
> >     > Cc: <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a> <mailto:<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a>>,<br>
> >     "aaron ballman" <<a href="mailto:aaron.ballman@gmail.com">aaron.ballman@gmail.com</a><br>
> >     <mailto:<a href="mailto:aaron.ballman@gmail.com">aaron.ballman@gmail.com</a>>>, <a href="mailto:bigcheesegs@gmail.com">bigcheesegs@gmail.com</a><br>
> >     <mailto:<a href="mailto:bigcheesegs@gmail.com">bigcheesegs@gmail.com</a>>, <a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a><br>
> >     <mailto:<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>><br>
> >     > Sent: Friday, September 26, 2014 12:26:29 AM<br>
> >     > Subject: Re: [PATCH] align_value attribute in Clang<br>
> >     ><br>
> >     > 1. ICC does not create a new type for type with this<br>
> >     > attribute. All<br>
> >     > types are still the same.<br>
> >     > 2.<br>
> >     ><br>
> >     > int n __attribute__((aligned(32)));<br>
> >     > decltype(&n) - int*.<br>
> >     ><br>
> >     ><br>
> >     > Best regards,<br>
> >     > Alexey Bataev<br>
> >     > =============<br>
> >     > Software Engineer<br>
> >     > Intel Compiler Team<br>
> >     ><br>
> >     > 26.09.2014 4:28, Hal Finkel пишет:<br>
> >     > > ----- Original Message -----<br>
> >     > >> From: "Richard Smith" <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a><br>
> >     <mailto:<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>>><br>
> >     > >> To: <a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a> <mailto:<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>>, "aaron<br>
> >     > >> ballman"<br>
> >     <<a href="mailto:aaron.ballman@gmail.com">aaron.ballman@gmail.com</a> <mailto:<a href="mailto:aaron.ballman@gmail.com">aaron.ballman@gmail.com</a>>>,<br>
> >     > >> <a href="mailto:bigcheesegs@gmail.com">bigcheesegs@gmail.com</a> <mailto:<a href="mailto:bigcheesegs@gmail.com">bigcheesegs@gmail.com</a>>,<br>
> >     <a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a> <mailto:<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>>, "a<br>
> >     > >> bataev" <<a href="mailto:a.bataev@hotmail.com">a.bataev@hotmail.com</a><br>
> >     > >> <mailto:<a href="mailto:a.bataev@hotmail.com">a.bataev@hotmail.com</a>>><br>
> >     > >> Cc: <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> >     > >> <mailto:<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a>><br>
> >     > >> Sent: Thursday, September 25, 2014 7:06:33 PM<br>
> >     > >> Subject: Re: [PATCH] align_value attribute in Clang<br>
> >     > >><br>
> >     > >> I'd like some more information about how ICC treats this<br>
> >     > >> attribute.<br>
> >     > >> Does it produce a new type? For instance:<br>
> >     > > I did a quick experiment with icc (ICC) 14.0.1 20131008<br>
> >     > > (with<br>
> >     -Wall<br>
> >     > > -O3 -pedantic):<br>
> >     > ><br>
> >     > >>    typedef int *I32 __attribute__((align_value(32)));<br>
> >     > >>    typedef int *I64 __attribute__((align_value(64)));<br>
> >     > >><br>
> >     > >>    typedef I32 X; typedef I64 X; // ill-formed?<br>
> >     > > No diagnostic.<br>
> >     > ><br>
> >     > >>    template<typename> struct Y;<br>
> >     > >>    typedef Y<I32> Z; typedef Y<I64> Z; // ill-formed?<br>
> >     > > No diagnostic.<br>
> >     > ><br>
> >     > >>    extern I32 i32;<br>
> >     > >>    I64 i64 = i32; // ill-formed? Is an explicit cast<br>
> >     > >>    required?<br>
> >     > > No diagnostic.<br>
> >     > ><br>
> >     > >>    I32 i32 = i64; // ill-formed? Is there an implicit<br>
> >     > >>    conversion<br>
> >     > >>    that<br>
> >     > >>    discards alignment?<br>
> >     > > No diagnostic.<br>
> >     > ><br>
> >     > > Alexey, can you please comment on the specifics?<br>
> >     > ><br>
> >     > >   -Hal<br>
> >     > ><br>
> >     > >> ... and if there's an implicit conversion that discards<br>
> >     alignment,<br>
> >     > >> what is its conversion rank?<br>
> >     > >><br>
> >     > >> If I have:<br>
> >     > >><br>
> >     > >>    int n __attribute__((aligned(32)));<br>
> >     > >><br>
> >     > >> ... then what is `decltype(&n)`? Is it `int*`, or `int*<br>
> >     > >> __attribute__((align_value(32)))`?<br>
> >     > >><br>
> >     > >> <a href="http://reviews.llvm.org/D4635" target="_blank">http://reviews.llvm.org/D4635</a><br>
> >     > >><br>
> >     > >><br>
> >     > >><br>
> >     ><br>
> >     ><br>
> ><br>
> >     --<br>
> >     Hal Finkel<br>
> >     Assistant Computational Scientist<br>
> >     Leadership Computing Facility<br>
> >     Argonne National Laboratory<br>
> ><br>
> ><br>
><br>
><br>
<br>
--<br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
</div></div></blockquote></div><br></div></div>