[PR85793] Fix ICE by loading vector(1) scalara_type for 1 element-wise case

Message ID DB6PR0802MB250460A9A9E47AC12F1482B5E7920@DB6PR0802MB2504.eurprd08.prod.outlook.com
State New
Headers show
Series
  • [PR85793] Fix ICE by loading vector(1) scalara_type for 1 element-wise case
Related show

Commit Message

Bin Cheng May 16, 2018, 3:13 p.m.
Hi,
This patch fixes ICE by loading vector(1) scalar_type if it's 1 element-wise for VMAT_ELEMENTWISE.
Bootstrap and test on x86_64 and AArch64 ongoing.  Is it OK?

Thanks,
bin
2018-05-16  Bin Cheng  <bin.cheng@arm.com>
	    Richard Biener  <rguenther@suse.de>

	PR tree-optimization/85793
	* tree-vect-stmts.c (vectorizable_load): Handle 1 element-wise load
	for VMAT_ELEMENTWISE.

gcc/testsuite
2018-05-16  Bin Cheng  <bin.cheng@arm.com>

	PR tree-optimization/85793
	* gcc.dg/vect/pr85793.c: New test.

Comments

Richard Biener May 17, 2018, 10:07 a.m. | #1
On Wed, May 16, 2018 at 5:13 PM Bin Cheng <Bin.Cheng@arm.com> wrote:

> Hi,

> This patch fixes ICE by loading vector(1) scalar_type if it's 1

element-wise for VMAT_ELEMENTWISE.
> Bootstrap and test on x86_64 and AArch64 ongoing.  Is it OK?


OK.

Richard.

> Thanks,

> bin

> 2018-05-16  Bin Cheng  <bin.cheng@arm.com>

>              Richard Biener  <rguenther@suse.de>


>          PR tree-optimization/85793

>          * tree-vect-stmts.c (vectorizable_load): Handle 1 element-wise

load
>          for VMAT_ELEMENTWISE.


> gcc/testsuite

> 2018-05-16  Bin Cheng  <bin.cheng@arm.com>


>          PR tree-optimization/85793

>          * gcc.dg/vect/pr85793.c: New test.
Bin.Cheng May 17, 2018, 10:11 a.m. | #2
On Thu, May 17, 2018 at 11:07 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Wed, May 16, 2018 at 5:13 PM Bin Cheng <Bin.Cheng@arm.com> wrote:

>

>> Hi,

>> This patch fixes ICE by loading vector(1) scalar_type if it's 1

> element-wise for VMAT_ELEMENTWISE.

>> Bootstrap and test on x86_64 and AArch64 ongoing.  Is it OK?

>

> OK.

Bootstrap and test finished well.  I also need approval for GCC 8 backport.

Thanks,
bin
>

> Richard.

>

>> Thanks,

>> bin

>> 2018-05-16  Bin Cheng  <bin.cheng@arm.com>

>>              Richard Biener  <rguenther@suse.de>

>

>>          PR tree-optimization/85793

>>          * tree-vect-stmts.c (vectorizable_load): Handle 1 element-wise

> load

>>          for VMAT_ELEMENTWISE.

>

>> gcc/testsuite

>> 2018-05-16  Bin Cheng  <bin.cheng@arm.com>

>

>>          PR tree-optimization/85793

>>          * gcc.dg/vect/pr85793.c: New test.
Richard Biener May 17, 2018, 10:54 a.m. | #3
On Thu, May 17, 2018 at 12:11 PM Bin.Cheng <amker.cheng@gmail.com> wrote:

> On Thu, May 17, 2018 at 11:07 AM, Richard Biener

> <richard.guenther@gmail.com> wrote:

> > On Wed, May 16, 2018 at 5:13 PM Bin Cheng <Bin.Cheng@arm.com> wrote:

> >

> >> Hi,

> >> This patch fixes ICE by loading vector(1) scalar_type if it's 1

> > element-wise for VMAT_ELEMENTWISE.

> >> Bootstrap and test on x86_64 and AArch64 ongoing.  Is it OK?

> >

> > OK.

> Bootstrap and test finished well.  I also need approval for GCC 8

backport.

Ok to backport.

> Thanks,

> bin

> >

> > Richard.

> >

> >> Thanks,

> >> bin

> >> 2018-05-16  Bin Cheng  <bin.cheng@arm.com>

> >>              Richard Biener  <rguenther@suse.de>

> >

> >>          PR tree-optimization/85793

> >>          * tree-vect-stmts.c (vectorizable_load): Handle 1 element-wise

> > load

> >>          for VMAT_ELEMENTWISE.

> >

> >> gcc/testsuite

> >> 2018-05-16  Bin Cheng  <bin.cheng@arm.com>

> >

> >>          PR tree-optimization/85793

> >>          * gcc.dg/vect/pr85793.c: New test.

Patch

From 85ef7f0c6ee0cb89804f1cd9d5a39ba26f8aaba3 Mon Sep 17 00:00:00 2001
From: Bin Cheng <binche01@e108451-lin.cambridge.arm.com>
Date: Wed, 16 May 2018 14:30:06 +0100
Subject: [PATCH] pr85793-20180515

---
 gcc/testsuite/gcc.dg/vect/pr85793.c | 12 ++++++++++++
 gcc/tree-vect-stmts.c               |  4 ++++
 2 files changed, 16 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/vect/pr85793.c

diff --git a/gcc/testsuite/gcc.dg/vect/pr85793.c b/gcc/testsuite/gcc.dg/vect/pr85793.c
new file mode 100644
index 0000000..9b5d518
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr85793.c
@@ -0,0 +1,12 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_perm } */
+
+int a, c, d;
+long b[6];
+void fn1() {
+  for (; a < 2; a++) {
+    c = 0;
+    for (; c <= 5; c++)
+      d &= b[a * 3];
+  }
+}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 1e8ccbc..64a157d 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -7662,6 +7662,10 @@  vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
 	    }
 	  ltype = build_aligned_type (ltype, TYPE_ALIGN (TREE_TYPE (vectype)));
 	}
+      /* Load vector(1) scalar_type if it's 1 element-wise vectype.  */
+      else if (nloads == 1)
+	ltype = vectype;
+
       if (slp)
 	{
 	  /* For SLP permutation support we need to load the whole group,
-- 
1.9.1