public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Fix PR tree-optimization/49471
@ 2011-07-25 14:59 Razya Ladelsky
  2011-07-25 15:02 ` Richard Guenther
  0 siblings, 1 reply; 10+ messages in thread
From: Razya Ladelsky @ 2011-07-25 14:59 UTC (permalink / raw)
  To: gcc-patches; +Cc: Zdenek Dvorak, Richard Guenther

[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]

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.



[-- Attachment #2: cactus_dealII_patch.txt --]
[-- Type: text/plain, Size: 1085 bytes --]

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));
      }
  
=

^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <OFF30BDBA7.EDA96197-ONC22578D8.004A758E-C22578D8.0050EFC9@LocalDomain>]

end of thread, other threads:[~2011-07-31 10:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-25 14:59 [patch] Fix PR tree-optimization/49471 Razya Ladelsky
2011-07-25 15:02 ` Richard Guenther
2011-07-26 13:53   ` Razya Ladelsky
2011-07-26 14:07     ` Richard Guenther
2011-07-26 18:27       ` Sebastian Pop
2011-07-27  9:41         ` Richard Guenther
2011-07-30 21:56   ` Zdenek Dvorak
2011-07-31 10:45     ` Richard Guenther
2011-07-31 15:16       ` Zdenek Dvorak
     [not found] <OFF30BDBA7.EDA96197-ONC22578D8.004A758E-C22578D8.0050EFC9@LocalDomain>
2011-07-25 15:16 ` Razya Ladelsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).