diff mbox series

Fix poly types after PR tree-optimization/71625 strlen optimization

Message ID fac19fd2-faf4-4307-c08b-a3c8d9a07f5e@arm.com
State New
Headers show
Series Fix poly types after PR tree-optimization/71625 strlen optimization | expand

Commit Message

Szabolcs Nagy Aug. 17, 2018, 5:18 p.m. UTC
On 15/08/18 16:51, Martin Sebor wrote:
> On 08/15/2018 04:28 AM, James Greenhalgh wrote:
>> On Tue, Aug 14, 2018 at 09:34:08PM -0500, Martin Sebor wrote:
>>> On 08/14/2018 09:24 AM, Martin Sebor wrote:
>>>> On 08/14/2018 09:08 AM, Martin Sebor wrote:
>>>> --- gcc/config/aarch64/aarch64-builtins.c    (revision 263537)
>>>> +++ gcc/config/aarch64/aarch64-builtins.c    (working copy)
>>>> @@ -643,6 +643,7 @@ aarch64_init_simd_builtin_types (void)
>>>>    /* Poly types are a world of their own.  */
>>>>    aarch64_simd_types[Poly8_t].eltype = aarch64_simd_types[Poly8_t].itype =
>>>>      build_distinct_type_copy (unsigned_intQI_type_node);
>>>> +  TYPE_STRING_FLAG (aarch64_simd_types[Poly8_t].eltype) = false;
>>>>    aarch64_simd_types[Poly16_t].eltype =
>>>> aarch64_simd_types[Poly16_t].itype =
>>>>      build_distinct_type_copy (unsigned_intHI_type_node);
>>>>    aarch64_simd_types[Poly64_t].eltype =
>>>> aarch64_simd_types[Poly64_t].itype =
>>
>> This fix seems correct to me, the poly types are not strings. Looking at
>> other uses of TYPE_STRING_FLAG this change doesn't seem like it would have
>> impact on parsing or code generation.
>>
>> OK for trunk.
> 
> I committed this in r263561.
> 

happens on arm too.

Same as r263561, but for arm: avoid compilation errors caused by poly
initializers getting treated as string literals.

Tested on arm-none-linux-gnueabihf.

gcc/ChangeLog:
2018-08-17  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* config/arm/arm-builtins.c (arm_init_simd_builtin_types): Clear
	polyNxK_t element's TYPE_STRING_FLAG.

Comments

Kyrill Tkachov Aug. 17, 2018, 5:22 p.m. UTC | #1
Hi Szabolcs,

On 17/08/18 18:18, Szabolcs Nagy wrote:
> On 15/08/18 16:51, Martin Sebor wrote:
> > On 08/15/2018 04:28 AM, James Greenhalgh wrote:
> >> On Tue, Aug 14, 2018 at 09:34:08PM -0500, Martin Sebor wrote:
> >>> On 08/14/2018 09:24 AM, Martin Sebor wrote:
> >>>> On 08/14/2018 09:08 AM, Martin Sebor wrote:
> >>>> --- gcc/config/aarch64/aarch64-builtins.c    (revision 263537)
> >>>> +++ gcc/config/aarch64/aarch64-builtins.c    (working copy)
> >>>> @@ -643,6 +643,7 @@ aarch64_init_simd_builtin_types (void)
> >>>>    /* Poly types are a world of their own. */
> >>>>    aarch64_simd_types[Poly8_t].eltype = aarch64_simd_types[Poly8_t].itype =
> >>>>      build_distinct_type_copy (unsigned_intQI_type_node);
> >>>> +  TYPE_STRING_FLAG (aarch64_simd_types[Poly8_t].eltype) = false;
> >>>>    aarch64_simd_types[Poly16_t].eltype =
> >>>> aarch64_simd_types[Poly16_t].itype =
> >>>>      build_distinct_type_copy (unsigned_intHI_type_node);
> >>>>    aarch64_simd_types[Poly64_t].eltype =
> >>>> aarch64_simd_types[Poly64_t].itype =
> >>
> >> This fix seems correct to me, the poly types are not strings. Looking at
> >> other uses of TYPE_STRING_FLAG this change doesn't seem like it would have
> >> impact on parsing or code generation.
> >>
> >> OK for trunk.
> >
> > I committed this in r263561.
> >
>
> happens on arm too.
>
> Same as r263561, but for arm: avoid compilation errors caused by poly
> initializers getting treated as string literals.
>
> Tested on arm-none-linux-gnueabihf.
>
> gcc/ChangeLog:
> 2018-08-17  Szabolcs Nagy  <szabolcs.nagy@arm.com>
>
>         * config/arm/arm-builtins.c (arm_init_simd_builtin_types): Clear
>         polyNxK_t element's TYPE_STRING_FLAG.


diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c
index 183a7b907f6..563ca51dcd0 100644
--- a/gcc/config/arm/arm-builtins.c
+++ b/gcc/config/arm/arm-builtins.c
@@ -927,6 +927,11 @@ arm_init_simd_builtin_types (void)
    (*lang_hooks.types.register_builtin_type) (arm_simd_polyTI_type_node,
  					     "__builtin_neon_poly128");
  
+  /* Prevent front-ends from transforming poly vectors into string
+     literals.  */
+  TYPE_STRING_FLAG (arm_simd_polyQI_type_node) = false;
+  TYPE_STRING_FLAG (arm_simd_polyHI_type_node) = false;
+
    /* Init all the element types built by the front-end.  */
    arm_simd_types[Int8x8_t].eltype = intQI_type_node;
    arm_simd_types[Int8x16_t].eltype = intQI_type_node;

Ok.
Thanks,
Kyrill
diff mbox series

Patch

diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c
index 183a7b907f6..563ca51dcd0 100644
--- a/gcc/config/arm/arm-builtins.c
+++ b/gcc/config/arm/arm-builtins.c
@@ -927,6 +927,11 @@  arm_init_simd_builtin_types (void)
   (*lang_hooks.types.register_builtin_type) (arm_simd_polyTI_type_node,
 					     "__builtin_neon_poly128");
 
+  /* Prevent front-ends from transforming poly vectors into string
+     literals.  */
+  TYPE_STRING_FLAG (arm_simd_polyQI_type_node) = false;
+  TYPE_STRING_FLAG (arm_simd_polyHI_type_node) = false;
+
   /* Init all the element types built by the front-end.  */
   arm_simd_types[Int8x8_t].eltype = intQI_type_node;
   arm_simd_types[Int8x16_t].eltype = intQI_type_node;