This fixes an anonymous SSA name issue.

Bootstrapped and tested on x86_64-unknonw-linux-gnu, applied.

Richard.

2013-05-06  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/57185
        * tree-parloops.c (add_field_for_reduction): Handle anonymous
        SSA names properly.

        * gcc.dg/autopar/pr57185.c: New testcase.

Index: gcc/tree-parloops.c
===================================================================
*** gcc/tree-parloops.c (revision 198625)
--- gcc/tree-parloops.c (working copy)
*************** add_field_for_reduction (reduction_info
*** 964,972 ****
  {
  
    struct reduction_info *const red = *slot;
!   tree var = SSA_NAME_VAR (gimple_assign_lhs (red->reduc_stmt));
!   tree field = build_decl (gimple_location (red->reduc_stmt),
!                          FIELD_DECL, DECL_NAME (var), TREE_TYPE (var));
  
    insert_field_into_struct (type, field);
  
--- 964,972 ----
  {
  
    struct reduction_info *const red = *slot;
!   tree var = gimple_assign_lhs (red->reduc_stmt);
!   tree field = build_decl (gimple_location (red->reduc_stmt), FIELD_DECL,
!                          SSA_NAME_IDENTIFIER (var), TREE_TYPE (var));
  
    insert_field_into_struct (type, field);
  
Index: gcc/testsuite/gcc.dg/autopar/pr57185.c
===================================================================
*** gcc/testsuite/gcc.dg/autopar/pr57185.c      (revision 0)
--- gcc/testsuite/gcc.dg/autopar/pr57185.c      (working copy)
***************
*** 0 ****
--- 1,29 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O3 -ftree-parallelize-loops=2 -fipa-pta" } */
+ 
+ int a, b;
+ int *d;
+ void f(void)
+ {
+   int c;
+   b %= 1;
+ 
+   if(1 - (b < 1))
+     {
+       int *q = 0;
+ 
+       if(a)
+       {
+         c = 0;
+ lbl:
+         for(*d; *d; ++*d)
+           if(c ? : a ? : (c = 1) ? : 0)
+             *q &= 1;
+         return;
+       }
+ 
+       q = (int *)1;
+     }
+   goto lbl;
+ }
+ 

Reply via email to