This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix invalid assumption in vect_transform_stmt (PR 86871)


On August 9, 2018 4:37:57 PM GMT+02:00, Richard Sandiford <richard.sandiford@arm.com> wrote:
>The handling of outer-loop uses of inner-loop definitions assumed
>that anything that wasn't a PHI would be a gassign, but as the test
>shows, it's also possible for it to be a gcall.
>
>Tested on aarch64-linux-gnu (with and without SVE), aarch64_be-elf and
>x86_64-linux-gnu.  Applied as obvious to trunk, but OK for GCC 8 too?

OK. 

Richard. 

>Richard
>
>
>2018-08-09  Richard Sandiford  <richard.sandiford@arm.com>
>
>gcc/
>	PR tree-optimization/86871
>	* tree-vect-stmts.c (vect_transform_stmt): Use gimple_get_lhs
>	instead of gimple_assign_lhs.
>
>gcc/testsuite/
>	PR tree-optimization/86871
>	* gcc.dg/vect/pr86871.c: New test.
>
>Index: gcc/tree-vect-stmts.c
>===================================================================
>--- gcc/tree-vect-stmts.c	2018-08-01 16:29:32.291384402 +0100
>+++ gcc/tree-vect-stmts.c	2018-08-09 15:34:54.968197176 +0100
>@@ -9804,7 +9804,7 @@ vect_transform_stmt (stmt_vec_info stmt_
>       if (gimple_code (stmt) == GIMPLE_PHI)
>         scalar_dest = PHI_RESULT (stmt);
>       else
>-        scalar_dest = gimple_assign_lhs (stmt);
>+        scalar_dest = gimple_get_lhs (stmt);
> 
>       FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest)
> 	if (!flow_bb_inside_loop_p (innerloop, gimple_bb (USE_STMT (use_p))))
>Index: gcc/testsuite/gcc.dg/vect/pr86871.c
>===================================================================
>--- /dev/null	2018-07-26 10:26:13.137955424 +0100
>+++ gcc/testsuite/gcc.dg/vect/pr86871.c	2018-08-09 15:34:54.964197212
>+0100
>@@ -0,0 +1,15 @@
>+/* { dg-do compile } */
>+
>+extern int b[];
>+extern int c[];
>+void g(int f) {
>+  for (; f; f++) {
>+    int d = 0;
>+    for (int e = -1; e <= 1; e++) {
>+      int a = f + e;
>+      if (a)
>+        d = *(c + a);
>+    }
>+    *(b + f) = d;
>+  }
>+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]