[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
This commit is contained in:
Jeff Law 2015-10-12 10:26:09 -06:00 committed by Jeff Law
parent 56102c7f97
commit bba71f811c
4 changed files with 60 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2015-10-12 Jeff Law <law@redhat.com>
* tree-ssa-threadbackward.c (fsm_find_thread_path): Remove
restriction that traced SSA_NAME is a user variable.
2015-10-12 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/67476

View File

@ -1,3 +1,7 @@
2015-10-12 Jeff Law <law@redhat.com>
* gcc.dg/tree-ssa/ssa-dom-thread-11.c: New test.
2015-10-12 Ville Voutilainen <ville.voutilainen@gmail.com>
PR c++/58566

View File

@ -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;
}
}
}

View File

@ -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<basic_block, va_gc> *&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