From 8f895cf1ac7babe0c89533e8e9e6b6ca6bb33950 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Fri, 13 Feb 2015 14:09:58 -0700 Subject: re PR tree-optimization/64823 (false "may be used uninitialized", missed jump threading) PR tree-optimization/64823 * tree-vrp.c (identify_jump_threads): Handle blocks with no statements. * tree-ssa-threadedge.c (potentially_threadable_block): Allow threading through blocks with PHIs, but no statements. (thread_through_normal_block): Distinguish between blocks where we did not process all the statements and blocks with no statements. PR tree-optimization/64823 gcc.dg/uninit-20.c: New test. From-SVN: r220696 --- gcc/tree-vrp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'gcc/tree-vrp.c') diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index dad1830..7367684 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -10181,8 +10181,15 @@ identify_jump_threads (void) /* We're basically looking for a switch or any kind of conditional with integral or pointer type arguments. Note the type of the second argument will be the same as the first argument, so no need to - check it explicitly. */ - if (gimple_code (last) == GIMPLE_SWITCH + check it explicitly. + + We also handle the case where there are no statements in the + block. This come up with forwarder blocks that are not + optimized away because they lead to a loop header. But we do + want to thread through them as we can sometimes thread to the + loop exit which is obviously profitable. */ + if (!last + || gimple_code (last) == GIMPLE_SWITCH || (gimple_code (last) == GIMPLE_COND && TREE_CODE (gimple_cond_lhs (last)) == SSA_NAME && (INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (last))) -- cgit v1.1