[PATCH] D87304: [AttributeFuncs] Consider `align` in `typeIncompatible`

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 05:29:32 PDT 2020


anna added a comment.

In D87304#2319424 <https://reviews.llvm.org/D87304#2319424>, @jdoerfert wrote:

> In D87304#2318780 <https://reviews.llvm.org/D87304#2318780>, @dantrushin wrote:
>
>> I wonder if `align` attribute is legal for vectors of pointers?
>> This is allowed:
>>
>>   define align 8 i32* @test_scalar(i32* %in) {
>>     ret i32* %in
>>   }
>>
>> but this is not:
>>
>>   define align 8 <4 x i32*> @test_vector(<4 x i32*> %in) {
>>     ret <4 x i32*> %in
>>   }
>>
>> Is it intentional behavior or just has been overlooked?
>
> The way I read the lang ref this is intentional. Not to say one should not define what it means for vectors of pointers and then allow it. I feel align is not the only one missing for them though.
> You want to give it a try?

@jdoerfert I'm wondering why we need to specially treat vector of pointers? We can add a LangRef statement for this, but vector is just another type. The way I read it, whatever is done for the scalar type, we do so for the vector type by considering each element. 
So, in this case, the `align 8 <4 x i32*>` implies that each pointer in the vector is aligned by 8 bytes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87304/new/

https://reviews.llvm.org/D87304



More information about the llvm-commits mailing list