Re: [PATCH] Make jump thread path carry more information

2013-09-27 Thread Jeff Law

On 09/27/2013 08:42 AM, James Greenhalgh wrote:

On Thu, Sep 26, 2013 at 04:26:35AM +0100, Jeff Law wrote:

Bootstrapped and regression tested on x86_64-unknown-linux-gnu.
Installed on trunk.


Hi Jeff,

This patch caused a regression on Arm and AArch64 in:

PASS-FAIL: gcc.c-torture/execute/memcpy-2.c execution,  -O3 
-fomit-frame-pointer

 From what I can see, the only place the behaviour of the threader has
changed is in this hunk:
Yes.  The old code was dropping the tail off the thread path; if we're 
seeing failures on the ARM port as a result of fixing that goof we 
obviously need to address them.


Let me take a looksie :-)

If you could pass along a .i file it'd be helpful in case I want to look 
at something under the debugger.



jeff



Re: [PATCH] Make jump thread path carry more information

2013-09-27 Thread James Greenhalgh
On Fri, Sep 27, 2013 at 04:32:10PM +0100, Jeff Law wrote:
 If you could pass along a .i file it'd be helpful in case I want to look 
 at something under the debugger.

I've opened http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58553 to save
everyone's inboxes.

Let me know if I can do anything else to help.

Cheers,
James



Re: [PATCH] Make jump thread path carry more information

2013-09-27 Thread Jeff Law

On 09/27/2013 10:48 AM, James Greenhalgh wrote:

On Fri, Sep 27, 2013 at 04:32:10PM +0100, Jeff Law wrote:

If you could pass along a .i file it'd be helpful in case I want to look
at something under the debugger.


I've opened http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58553 to save
everyone's inboxes.

Let me know if I can do anything else to help.

THanks.  I'm investigating.

jeff


[PATCH] Make jump thread path carry more information

2013-09-25 Thread Jeff Law


This patch conveys information about the blocks/edges in a jump 
threading path.  Of particular interest is information about the source 
block in each edge of the path -- the nature of the block determines our 
copy strategy (empty -- no copy, normal copy, joiner copy).


Rather than rediscover the nature of those blocks during the CFG/SSA 
graph updating, it's easier to just attach the information to each edge 
in the path.  That's precisely what this patch does.


The SSA/CFG updating code isn't making much use of this yet, that's a 
follow-on change.  This change is strictly designed to get the 
information into the updating code.



Bootstrapped and regression tested on x86_64-unknown-linux-gnu. 
Installed on trunk.





diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5adbaeb..8871aca 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,26 @@
+2013-09-25  Jeff Law  l...@redhat.com
+
+   * tree-flow.h (thread_through_all_blocks): Prototype moved into
+   tree-ssa-threadupdate.h.
+   (register_jump_thread): Similarly.
+   * tree-ssa-threadupdate.h: New header file.
+   * tree-ssa-dom.c: Include tree-ssa-threadupdate.h.
+   * tree-vrp.c: Likewise.
+   * tree-ssa-threadedge.c: Include tree-ssa-threadupdate.h.
+   (thread_around_empty_blocks): Change type of path vector argument to
+   an edge,type pair from just an edge.  Initialize both elements when
+   appending to a jump threading path.  Tweak references to elements
+   appropriately.
+   (thread_across_edge): Similarly.  Release memory for the elements
+   as needed.
+   * tree-ssa-threadupdate.c: Include tree-ssa-threadupdate.h.
+   (dump_jump_thread_path): New function broken out from
+   register_jump_thread.
+   (register_jump_thread): Use dump_jump_thread_path.  Change type of
+   path vector entries.  Search the path for NULL edges and dump
+   the path if one is found.  Tweak the conversion of path to 3-edge
+   form to use the block copy type information embedded in the path.
+
 2013-09-25  Yvan Roux  yvan.r...@linaro.org
 
* lra.c (update_inc_notes): Remove all REG_DEAD and REG_UNUSED notes.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 634e747..a264056 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,6 @@
+2013-09-25  Jeff Law  l...@redhat.com
+
+   * gcc.dg/tree-ssa/ssa-dom-thread-3.c: Update expected output.
 2013-09-25  Tobias Burnus  bur...@net-b.de
 
PR fortran/58436
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c 
b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c
index d2a1fbb..222a97b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c
@@ -43,7 +43,6 @@ expand_one_var (tree var, unsigned char toplevel, unsigned 
char really_expand)
 }
 /* We should thread the jump, through an intermediate block.  */
 /* { dg-final { scan-tree-dump-times Threaded 1 dom1} } */
-/* { dg-final { scan-tree-dump-times Registering jump thread .through joiner 
block.: \\(.*\\);  \\(.*\\);  \\(.*\\); 1 dom1} } */
-
+/* { dg-final { scan-tree-dump-times Registering jump thread: \\(.*\\) 
incoming edge;  \\(.*\\) joiner;  \\(.*\\) nocopy; 1 dom1} } */
 /* { dg-final { cleanup-tree-dump dom1 } } */
 
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 2f64abc..ee69179 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -641,10 +641,6 @@ bool multiplier_allowed_in_address_p (HOST_WIDE_INT, enum 
machine_mode,
  addr_space_t);
 bool may_be_nonaddressable_p (tree expr);
 
-/* In tree-ssa-threadupdate.c.  */
-extern bool thread_through_all_blocks (bool);
-extern void register_jump_thread (vecedge, bool);
-
 /* In gimplify.c  */
 tree force_gimple_operand_1 (tree, gimple_seq *, gimple_predicate, tree);
 tree force_gimple_operand (tree, gimple_seq *, bool, tree);
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index f0cc0ee..81119c3 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3.  If not see
 #include domwalk.h
 #include tree-pass.h
 #include tree-ssa-propagate.h
+#include tree-ssa-threadupdate.h
 #include langhooks.h
 #include params.h
 
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 2ca56342..467d982 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see
 #include dumpfile.h
 #include tree-ssa.h
 #include tree-ssa-propagate.h
+#include tree-ssa-threadupdate.h
 #include langhooks.h
 #include params.h
 
@@ -753,7 +754,7 @@ thread_around_empty_blocks (edge taken_edge,
bool handle_dominating_asserts,
tree (*simplify) (gimple, gimple),
bitmap visited,
-   vecedge *path)
+