diff mbox series

rs6000: MMA type causes an ICE in ranger pass due to incompatible types

Message ID 69382818-fafa-bab7-31be-01bc476d60b4@linux.ibm.com
State New
Headers show
Series rs6000: MMA type causes an ICE in ranger pass due to incompatible types | expand

Commit Message

Peter Bergner Oct. 21, 2020, 6 p.m. UTC
PR97360 shows a problem in how we create our PXI and POI modes that cause
an ICE in the ranger pass.  The problem seems to be that the extra call
to build_distinct_type_copy() also creates new TYPE_{MIN,MAX}_VALUEs that
are not compatible/the same as the base type itself.  The simple "fix" is
to actually remove the unneeded build_distinct_type_copy(), since according
to richi, the types returned from make_unsigned_type() are already distinct.

The following patch from Andrew and richi fixes the ICE on Martin's test
case and passes bootstrap and regtesting on powerpc64le-linux.
Ok for trunk?

Since the ranger code that triggered this doesn't seem to be in GCC 10,
I assume we do not want to backport this this change?

Peter


gcc/
	PR target/97360
	* config/rs6000/rs6000-call.c (rs6000_init_builtins): Remove call to
	build_distinct_type_copy().

gcc/testsuite/
	PR target/97360
	* gcc.target/powerpc/pr97360.c: New test.

Comments

Segher Boessenkool Oct. 21, 2020, 6:34 p.m. UTC | #1
Hi!

On Wed, Oct 21, 2020 at 01:00:20PM -0500, Peter Bergner wrote:
> PR97360 shows a problem in how we create our PXI and POI modes that cause
> an ICE in the ranger pass.  The problem seems to be that the extra call
> to build_distinct_type_copy() also creates new TYPE_{MIN,MAX}_VALUEs that
> are not compatible/the same as the base type itself.  The simple "fix" is
> to actually remove the unneeded build_distinct_type_copy(), since according
> to richi, the types returned from make_unsigned_type() are already distinct.
> 
> The following patch from Andrew and richi fixes the ICE on Martin's test
> case and passes bootstrap and regtesting on powerpc64le-linux.
> Ok for trunk?

Yes, okay for trunk.  Thanks!

> Since the ranger code that triggered this doesn't seem to be in GCC 10,
> I assume we do not want to backport this this change?

No, please do, in a week or so, it is a pretty serious problem that we
could just asa well run into some other way, as far as I can see?


Segher


> gcc/
> 	PR target/97360
> 	* config/rs6000/rs6000-call.c (rs6000_init_builtins): Remove call to
> 	build_distinct_type_copy().
> 
> gcc/testsuite/
> 	PR target/97360
> 	* gcc.target/powerpc/pr97360.c: New test.
Peter Bergner Oct. 21, 2020, 7:31 p.m. UTC | #2
On 10/21/20 1:34 PM, Segher Boessenkool wrote:
>> The following patch from Andrew and richi fixes the ICE on Martin's test
>> case and passes bootstrap and regtesting on powerpc64le-linux.
>> Ok for trunk?
> 
> Yes, okay for trunk.  Thanks!

Ok, pushed to trunk.  Thanks!



>> Since the ranger code that triggered this doesn't seem to be in GCC 10,
>> I assume we do not want to backport this this change?
> 
> No, please do, in a week or so, it is a pretty serious problem that we
> could just asa well run into some other way, as far as I can see?

Ok, I'll wait a week and then do the backport and testing.

Peter
Peter Bergner Nov. 7, 2020, 10:34 p.m. UTC | #3
On 10/21/20 2:31 PM, Peter Bergner wrote:
> Ok, I'll wait a week and then do the backport and testing.

I just pushed this to the GCC 10 release branch now.

Peter
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 9fdf97bc803..7639aab171d 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -12914,15 +12914,13 @@  rs6000_init_builtins (void)
   /* Vector pair and vector quad support.  */
   if (TARGET_EXTRA_BUILTINS)
     {
-      tree oi_uns_type = make_unsigned_type (256);
-      vector_pair_type_node = build_distinct_type_copy (oi_uns_type);
+      vector_pair_type_node = make_unsigned_type (256);
       SET_TYPE_MODE (vector_pair_type_node, POImode);
       layout_type (vector_pair_type_node);
       lang_hooks.types.register_builtin_type (vector_pair_type_node,
 					      "__vector_pair");
 
-      tree xi_uns_type = make_unsigned_type (512);
-      vector_quad_type_node = build_distinct_type_copy (xi_uns_type);
+      vector_quad_type_node = make_unsigned_type (512);
       SET_TYPE_MODE (vector_quad_type_node, PXImode);
       layout_type (vector_quad_type_node);
       lang_hooks.types.register_builtin_type (vector_quad_type_node,
diff --git a/gcc/testsuite/gcc.target/powerpc/pr97360.c b/gcc/testsuite/gcc.target/powerpc/pr97360.c
new file mode 100644
index 00000000000..2328d28a283
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr97360.c
@@ -0,0 +1,18 @@ 
+/* PR target/97360 */
+/* { dg-do compile } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+
+/* Verify we do not ICE on the test below.  */
+
+typedef unsigned char vec_t __attribute__((vector_size(16)));
+
+void
+foo (__vector_quad *dst, __vector_pair *vpair, vec_t *vec)
+{
+  __vector_quad acc = *dst;
+  for (;;)
+    {
+      __builtin_mma_xvf64gerpp(&acc, *vpair, vec[7]);
+    }
+}