public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR57511
@ 2013-09-02 11:32 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2013-09-02 11:32 UTC (permalink / raw)
  To: gcc-patches


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" } } */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-09-02 11:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-02 11:32 [PATCH] Fix PR57511 Richard Biener

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).