From: Jeff Law Date: Mon, 12 Oct 2015 16:26:09 +0000 (-0600) Subject: [PATCH] Improve FSM threader to handle compiler temporaries too X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bba71f811c1d6e46cc22399e2be401640e7eb0cd;p=gcc.git [PATCH] Improve FSM threader to handle compiler temporaries too * tree-ssa-threadbackward.c (fsm_find_thread_path): Remove restriction that traced SSA_NAME is a user variable. * gcc.dg/tree-ssa/ssa-dom-thread-11.c: New test. From-SVN: r228727 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c34e0840c58..32ec554fb91 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-10-12 Jeff Law + + * tree-ssa-threadbackward.c (fsm_find_thread_path): Remove + restriction that traced SSA_NAME is a user variable. + 2015-10-12 Tom de Vries PR tree-optimization/67476 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f4b7d26d920..89f33632865 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-10-12 Jeff Law + + * gcc.dg/tree-ssa/ssa-dom-thread-11.c: New test. + 2015-10-12 Ville Voutilainen PR c++/58566 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-11.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-11.c new file mode 100644 index 00000000000..03d033456a1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-11.c @@ -0,0 +1,49 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp2-details" } */ +/* { dg-final { scan-tree-dump "FSM" "vrp2" } } */ + +void abort (void); +typedef struct bitmap_head_def *bitmap; +typedef const struct bitmap_head_def *const_bitmap; +typedef struct bitmap_obstack +{ + struct bitmap_obstack *next; + unsigned int indx; +} +bitmap_element; +typedef struct bitmap_head_def +{ + bitmap_element *first; +} +bitmap_head; +static __inline__ unsigned char +bitmap_elt_ior (bitmap dst, bitmap_element * dst_elt, + bitmap_element * dst_prev, const bitmap_element * a_elt, + const bitmap_element * b_elt) +{ + ((void) (!(a_elt || b_elt) ? abort (), 0 : 0)); +} + +unsigned char +bitmap_ior_and_compl (bitmap dst, const_bitmap a, const_bitmap b, + const_bitmap kill) +{ + bitmap_element *dst_elt = dst->first; + const bitmap_element *a_elt = a->first; + const bitmap_element *b_elt = b->first; + const bitmap_element *kill_elt = kill->first; + bitmap_element *dst_prev = ((void *) 0); + while (a_elt || b_elt) + { + if (b_elt && kill_elt && kill_elt->indx == b_elt->indx + && (!a_elt || a_elt->indx >= b_elt->indx)); + else + { + bitmap_elt_ior (dst, dst_elt, dst_prev, a_elt, b_elt); + if (a_elt && b_elt && a_elt->indx == b_elt->indx) + ; + else if (a_elt && (!b_elt || a_elt->indx <= b_elt->indx)) + a_elt = a_elt->next; + } + } +} diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c index 0012aa39180..ff6481c9547 100644 --- a/gcc/tree-ssa-threadbackward.c +++ b/gcc/tree-ssa-threadbackward.c @@ -70,7 +70,7 @@ fsm_find_thread_path (basic_block start_bb, basic_block end_bb, return false; } -/* We trace the value of the variable EXPR back through any phi nodes looking +/* We trace the value of the SSA_NAME EXPR back through any phi nodes looking for places where it gets a constant value and save the path. Stop after having recorded MAX_PATHS jump threading paths. */ @@ -80,11 +80,10 @@ fsm_find_control_statement_thread_paths (tree expr, vec *&path, bool seen_loop_phi) { - tree var = SSA_NAME_VAR (expr); gimple *def_stmt = SSA_NAME_DEF_STMT (expr); basic_block var_bb = gimple_bb (def_stmt); - if (var == NULL || var_bb == NULL) + if (var_bb == NULL) return; /* For the moment we assume that an SSA chain only contains phi nodes, and