aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2015-02-13 14:09:58 -0700
committerJeff Law <law@gcc.gnu.org>2015-02-13 14:09:58 -0700
commit8f895cf1ac7babe0c89533e8e9e6b6ca6bb33950 (patch)
treeb427100e1f8bad39e331f65b368651e87cfa1721 /gcc/tree-vrp.c
parentbe1448389ab3038cccba3ed99e157bd6842ef88f (diff)
downloadgcc-8f895cf1ac7babe0c89533e8e9e6b6ca6bb33950.zip
gcc-8f895cf1ac7babe0c89533e8e9e6b6ca6bb33950.tar.gz
gcc-8f895cf1ac7babe0c89533e8e9e6b6ca6bb33950.tar.bz2
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
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c11
1 files changed, 9 insertions, 2 deletions
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)))