re PR tree-optimization/57864 (ICE in bitmap_set_replace_value, at tree-ssa-pre.c:862)
2014-05-07 Richard Biener <rguenther@suse.de> PR tree-optimization/57864 * tree-ssa-pre.c (phi_translate_1): Backport NAME case simplification from mainline. Do not lookup the VN value-number here. * gcc.dg/torture/pr57864.c: New testcase. From-SVN: r210144
This commit is contained in:
parent
7a6547fc50
commit
b81aaebd22
|
@ -1,3 +1,10 @@
|
|||
2014-05-07 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/57864
|
||||
* tree-ssa-pre.c (phi_translate_1): Backport NAME case
|
||||
simplification from mainline. Do not lookup the VN
|
||||
value-number here.
|
||||
|
||||
2014-05-07 Richard Biener <rguenther@suse.de>
|
||||
|
||||
Backport from mainline
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2014-05-07 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/57864
|
||||
* gcc.dg/torture/pr57864.c: New testcase.
|
||||
|
||||
2014-05-07 Richard Biener <rguenther@suse.de>
|
||||
|
||||
Backport from mainline
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/* { dg-do compile } */
|
||||
|
||||
union U {
|
||||
double val;
|
||||
union U *ptr;
|
||||
};
|
||||
|
||||
union U *d;
|
||||
double a;
|
||||
int b;
|
||||
int c;
|
||||
|
||||
static void fn1(union U *p1, int p2, _Bool p3)
|
||||
{
|
||||
union U *e;
|
||||
|
||||
if (p2 == 0)
|
||||
a = ((union U*)((unsigned long)p1 & ~1))->val;
|
||||
|
||||
if (b) {
|
||||
e = p1;
|
||||
} else if (c) {
|
||||
e = ((union U*)((unsigned long)p1 & ~1))->ptr;
|
||||
d = e;
|
||||
} else {
|
||||
e = 0;
|
||||
d = ((union U*)0)->ptr;
|
||||
}
|
||||
|
||||
fn1 (e, 0, 0);
|
||||
fn1 (0, 0, p3);
|
||||
}
|
||||
|
||||
void fn2 (void)
|
||||
{
|
||||
fn1 (0, 0, 0);
|
||||
}
|
|
@ -1756,39 +1756,26 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
|
|||
|
||||
case NAME:
|
||||
{
|
||||
gimple phi = NULL;
|
||||
edge e;
|
||||
gimple def_stmt;
|
||||
tree name = PRE_EXPR_NAME (expr);
|
||||
|
||||
def_stmt = SSA_NAME_DEF_STMT (name);
|
||||
gimple def_stmt = SSA_NAME_DEF_STMT (name);
|
||||
/* If the SSA name is defined by a PHI node in this block,
|
||||
translate it. */
|
||||
if (gimple_code (def_stmt) == GIMPLE_PHI
|
||||
&& gimple_bb (def_stmt) == phiblock)
|
||||
phi = def_stmt;
|
||||
else
|
||||
return expr;
|
||||
|
||||
e = find_edge (pred, gimple_bb (phi));
|
||||
if (e)
|
||||
{
|
||||
tree def = PHI_ARG_DEF (phi, e->dest_idx);
|
||||
pre_expr newexpr;
|
||||
|
||||
if (TREE_CODE (def) == SSA_NAME)
|
||||
def = VN_INFO (def)->valnum;
|
||||
edge e = find_edge (pred, gimple_bb (def_stmt));
|
||||
tree def = PHI_ARG_DEF (def_stmt, e->dest_idx);
|
||||
|
||||
/* Handle constant. */
|
||||
if (is_gimple_min_invariant (def))
|
||||
return get_or_alloc_expr_for_constant (def);
|
||||
|
||||
if (TREE_CODE (def) == SSA_NAME && ssa_undefined_value_p (def))
|
||||
return NULL;
|
||||
|
||||
newexpr = get_or_alloc_expr_for_name (def);
|
||||
return newexpr;
|
||||
return get_or_alloc_expr_for_name (def);
|
||||
}
|
||||
/* Otherwise return it unchanged - it will get cleaned if its
|
||||
value is not available in PREDs AVAIL_OUT set of expressions. */
|
||||
return expr;
|
||||
}
|
||||
return expr;
|
||||
|
||||
default:
|
||||
gcc_unreachable ();
|
||||
|
|
Loading…
Reference in New Issue