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]

[PATCH] Fix PR57511


The fix for PR55555/40281 was too broad which results in unhandled
IVs in some loops and thus missed optimizations.  The PR specifically
talks about missed final value replacement but I've seem IVOPTs
failing to detect BIVs like for gcc.dg/tree-ssa/reassoc-19.c.

The following again allows SCEVs like { 0, +, { 1, +, 1 }_1 }_1,
thus non-linear IVs.

Re-bootstrap and testing running on x86_64-unknown-linux-gnu.

Richard.

2013-09-02  Richard Biener  <rguenther@suse.de>

	PR middle-end/57511
	* tree-scalar-evolution.c (instantiate_scev_name): Allow
	non-linear SCEVs.

	* gcc.dg/tree-ssa/sccp-1.c: New testcase.

Index: gcc/tree-scalar-evolution.c
===================================================================
*** gcc/tree-scalar-evolution.c	(revision 202050)
--- gcc/tree-scalar-evolution.c	(working copy)
*************** instantiate_scev_name (basic_block insta
*** 2252,2257 ****
--- 2252,2258 ----
    else if (res != chrec_dont_know)
      {
        if (inner_loop
+ 	  && def_bb->loop_father != inner_loop
  	  && !flow_loop_nested_p (def_bb->loop_father, inner_loop))
  	/* ???  We could try to compute the overall effect of the loop here.  */
  	res = chrec_dont_know;
Index: gcc/testsuite/gcc.dg/tree-ssa/sccp-1.c
===================================================================
*** gcc/testsuite/gcc.dg/tree-ssa/sccp-1.c	(revision 0)
--- gcc/testsuite/gcc.dg/tree-ssa/sccp-1.c	(working copy)
***************
*** 0 ****
--- 1,15 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O2 -fdump-tree-optimized" } */
+ 
+ int main(int argc, char* argv[])
+ {
+   int i, a = 0;
+   for (i=0; i < 10; i++)
+     a += i + 0xff00ff;
+   return a;
+ }
+ 
+ /* There should be no loop left.  */
+ 
+ /* { dg-final { scan-tree-dump-times "goto" 0 "optimized" } } */
+ /* { dg-final { cleanup-tree-dump "optimized" } } */


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