* [PATCH] Use propagate_threaded_block_debug_into even in loop header copying pass (PR debug/54693)
@ 2012-11-06 11:01 Jakub Jelinek
2012-11-06 16:43 ` Jeff Law
2012-11-06 17:42 ` Alexandre Oliva
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelinek @ 2012-11-06 11:01 UTC (permalink / raw)
To: gcc-patches; +Cc: Alexandre Oliva
Hi!
This patch fixes
-FAIL: gcc.dg/guality/pr54693-2.c -O1 line 21 i == v + 1
-FAIL: gcc.dg/guality/pr54693-2.c -O2 line 21 i == v + 1
-FAIL: gcc.dg/guality/pr54693-2.c -O3 -fomit-frame-pointer line 21 i == v + 1
-FAIL: gcc.dg/guality/pr54693-2.c -O3 -g line 21 i == v + 1
-FAIL: gcc.dg/guality/pr54693.c -O1 line 22 i == c - 48
on both x86_64-linux and i686-linux (and the x/y/z tests in the new testcase
from UNSUPPORTED to PASS) by copying the debug stmt in ch pass similarly to
how jump threading does that.
Ok for trunk?
2012-11-06 Jakub Jelinek <jakub@redhat.com>
PR debug/54693
* tree-flow.h (propagate_threaded_block_debug_into): New prototype.
* tree-ssa-threadedge.c (propagate_threaded_block_debug_into): No
longer static.
* tree-ssa-loop-ch.c (copy_loop_headers): Use it.
* gcc.dg/guality/pr54693-2.c: New test.
--- gcc/tree-flow.h.jj 2012-10-30 18:48:57.000000000 +0100
+++ gcc/tree-flow.h 2012-11-06 11:10:44.996516737 +0100
@@ -1,6 +1,6 @@
/* Data and Control Flow Analysis for Trees.
- Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+ 2012 Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
This file is part of GCC.
@@ -689,6 +689,7 @@ extern void set_ssa_name_value (tree, tr
extern bool potentially_threadable_block (basic_block);
extern void thread_across_edge (gimple, edge, bool,
VEC(tree, heap) **, tree (*) (gimple, gimple));
+extern void propagate_threaded_block_debug_into (basic_block, basic_block);
/* In tree-ssa-loop-im.c */
/* The possibilities of statement movement. */
--- gcc/tree-ssa-threadedge.c.jj 2012-11-05 08:55:21.000000000 +0100
+++ gcc/tree-ssa-threadedge.c 2012-11-06 11:10:35.694570819 +0100
@@ -1,5 +1,5 @@
/* SSA Jump Threading
- Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Jeff Law <law@redhat.com>
@@ -613,7 +613,7 @@ cond_arg_set_in_bb (edge e, basic_block
/* Copy debug stmts from DEST's chain of single predecessors up to
SRC, so that we don't lose the bindings as PHI nodes are introduced
when DEST gains new predecessors. */
-static void
+void
propagate_threaded_block_debug_into (basic_block dest, basic_block src)
{
if (!MAY_HAVE_DEBUG_STMTS)
--- gcc/tree-ssa-loop-ch.c.jj 2012-11-01 09:33:25.000000000 +0100
+++ gcc/tree-ssa-loop-ch.c 2012-11-06 11:11:58.176089941 +0100
@@ -1,5 +1,5 @@
/* Loop header copying on trees.
- Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of GCC.
@@ -197,6 +197,7 @@ copy_loop_headers (void)
entry = loop_preheader_edge (loop);
+ propagate_threaded_block_debug_into (exit->dest, entry->dest);
if (!gimple_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs))
{
fprintf (dump_file, "Duplication failed.\n");
--- gcc/testsuite/gcc.dg/guality/pr54693-2.c.jj 2012-11-06 11:13:07.141687111 +0100
+++ gcc/testsuite/gcc.dg/guality/pr54693-2.c 2012-11-06 11:33:50.640589407 +0100
@@ -0,0 +1,33 @@
+/* PR debug/54693 */
+/* { dg-do run } */
+/* { dg-options "-g" } */
+
+int v;
+
+__attribute__((noinline, noclone)) void
+bar (int i)
+{
+ v = i;
+ asm volatile ("" : : "r" (i) : "memory");
+}
+
+__attribute__((noinline, noclone)) void
+foo (int x, int y, int z)
+{
+ int i = 0;
+ while (x > 3 && y > 3 && z > 3)
+ { /* { dg-final { gdb-test 21 "i" "v + 1" } } */
+ /* { dg-final { gdb-test 21 "x" "10 - i" } } */
+ bar (i); /* { dg-final { gdb-test 21 "y" "20 - 2 * i" } } */
+ /* { dg-final { gdb-test 21 "z" "30 - 3 * i" } } */
+ i++, x--, y -= 2, z -= 3;
+ }
+}
+
+int
+main ()
+{
+ v = -1;
+ foo (10, 20, 30);
+ return 0;
+}
Jakub
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Use propagate_threaded_block_debug_into even in loop header copying pass (PR debug/54693)
2012-11-06 11:01 [PATCH] Use propagate_threaded_block_debug_into even in loop header copying pass (PR debug/54693) Jakub Jelinek
@ 2012-11-06 16:43 ` Jeff Law
2012-11-06 17:42 ` Alexandre Oliva
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Law @ 2012-11-06 16:43 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches, Alexandre Oliva
On 11/06/2012 04:00 AM, Jakub Jelinek wrote:
> Hi!
>
> This patch fixes
> -FAIL: gcc.dg/guality/pr54693-2.c -O1 line 21 i == v + 1
> -FAIL: gcc.dg/guality/pr54693-2.c -O2 line 21 i == v + 1
> -FAIL: gcc.dg/guality/pr54693-2.c -O3 -fomit-frame-pointer line 21 i == v + 1
> -FAIL: gcc.dg/guality/pr54693-2.c -O3 -g line 21 i == v + 1
> -FAIL: gcc.dg/guality/pr54693.c -O1 line 22 i == c - 48
> on both x86_64-linux and i686-linux (and the x/y/z tests in the new testcase
> from UNSUPPORTED to PASS) by copying the debug stmt in ch pass similarly to
> how jump threading does that.
>
> Ok for trunk?
>
> 2012-11-06 Jakub Jelinek <jakub@redhat.com>
>
> PR debug/54693
> * tree-flow.h (propagate_threaded_block_debug_into): New prototype.
> * tree-ssa-threadedge.c (propagate_threaded_block_debug_into): No
> longer static.
> * tree-ssa-loop-ch.c (copy_loop_headers): Use it.
>
> * gcc.dg/guality/pr54693-2.c: New test.
OK.
jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Use propagate_threaded_block_debug_into even in loop header copying pass (PR debug/54693)
2012-11-06 11:01 [PATCH] Use propagate_threaded_block_debug_into even in loop header copying pass (PR debug/54693) Jakub Jelinek
2012-11-06 16:43 ` Jeff Law
@ 2012-11-06 17:42 ` Alexandre Oliva
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2012-11-06 17:42 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches
On Nov 6, 2012, Jakub Jelinek <jakub@redhat.com> wrote:
> 2012-11-06 Jakub Jelinek <jakub@redhat.com>
> PR debug/54693
> * tree-flow.h (propagate_threaded_block_debug_into): New prototype.
> * tree-ssa-threadedge.c (propagate_threaded_block_debug_into): No
> longer static.
> * tree-ssa-loop-ch.c (copy_loop_headers): Use it.
> * gcc.dg/guality/pr54693-2.c: New test.
Nice! I'd approve this if I was entitled to ;-)
--
Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist Red Hat Brazil Compiler Engineer
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-06 17:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-06 11:01 [PATCH] Use propagate_threaded_block_debug_into even in loop header copying pass (PR debug/54693) Jakub Jelinek
2012-11-06 16:43 ` Jeff Law
2012-11-06 17:42 ` Alexandre Oliva
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).