From 897da3034cc2b1e3675d891e833c6b2a02fd4fe5 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 15 Sep 2017 09:19:36 +0000 Subject: re PR tree-optimization/82217 (ICE on valid code at -O1 and above: in visit_phi, at tree-ssa-sccvn.c:3908) 2017-09-15 Richard Biener PR tree-optimization/82217 * tree-ssa-sccvn.c (visit_phi): Properly handle all VN_TOP but not undefined case. * gcc.dg/torture/pr82217.c: New testcase. From-SVN: r252796 --- gcc/tree-ssa-sccvn.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'gcc/tree-ssa-sccvn.c') diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 44618da..0b0c510 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -3901,13 +3901,10 @@ visit_phi (gimple *phi) if only a single edge is exectuable use its value. */ if (n_executable <= 1) result = seen_undef ? seen_undef : sameval; - /* If we saw only undefined values create a new undef SSA name to - avoid false equivalences. */ + /* If we saw only undefined values and VN_TOP use one of the + undefined values. */ else if (sameval == VN_TOP) - { - gcc_assert (seen_undef); - result = seen_undef; - } + result = seen_undef ? seen_undef : sameval; /* First see if it is equivalent to a phi node in this block. We prefer this as it allows IV elimination - see PRs 66502 and 67167. */ else if ((result = vn_phi_lookup (phi))) -- cgit v1.1