Hi,

This patch fixes the build failure of cactusADM and dealII spec2006 
benchmarks when autopar is enabled.
(for powerpc they fail only when -m32 is additionally enabled)

The problem originated in canonicalize_loop_ivs, where we iterate the 
header's phis in order to base all
the induction variables on a single control variable.
We use the largest precision of the loop's ivs in order to determine the 
type of the control variable. 

Since iterating the loop's phis takes into account not only the loop's 
ivs, but also reduction variables, 
we got precision values like 80 for x86, or 128 for ppc.
The compilers failed to create proper types for these sizes 
(respectively).

The proper behavior for determining the control variable's type is to take 
into account only the loop's ivs,
which is what this patch does. 

Bootstrap and testsuite pass successfully (as autopar is not enabled by 
default).
No new regressions when the testsuite is run with autopar enabled.
No new regressions for the run of spec2006 with autopar enabled, 

cactusADM and dealII benchmarks now pass successfully with autopar on 
powerpc and x86.

Thanks to Zdenek who helped me figure out the failure/fix. 
OK for trunk? 
Thanks,
Razya

ChangeLog:

   PR tree-optimization/49471
   * tree-vect-loop-manip.c (canonicalize_loop_ivs): Add condition to 
   ignore reduction variables when iterating the loop header's phis.


Index: tree-ssa-loop-manip.c
===================================================================
*** tree-ssa-loop-manip.c       (revision 175851)
--- tree-ssa-loop-manip.c       (working copy)
*************** canonicalize_loop_ivs (struct loop *loop
*** 1200,1205 ****
--- 1200,1206 ----
    gimple stmt;
    edge exit = single_dom_exit (loop);
    gimple_seq stmts;
+   affine_iv iv;
  
    for (psi = gsi_start_phis (loop->header);
         !gsi_end_p (psi); gsi_next (&psi))
*************** canonicalize_loop_ivs (struct loop *loop
*** 1207,1213 ****
        gimple phi = gsi_stmt (psi);
        tree res = PHI_RESULT (phi);
  
!       if (is_gimple_reg (res) && TYPE_PRECISION (TREE_TYPE (res)) > precision)
        precision = TYPE_PRECISION (TREE_TYPE (res));
      }
  
--- 1208,1216 ----
        gimple phi = gsi_stmt (psi);
        tree res = PHI_RESULT (phi);
  
!       if (is_gimple_reg (res) 
!         && simple_iv (loop, loop, res, &iv, true)
!         && TYPE_PRECISION (TREE_TYPE (res)) > precision)
        precision = TYPE_PRECISION (TREE_TYPE (res));
      }
  
=

Reply via email to