aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2015-02-16 13:56:55 -0700
committerJeff Law <law@gcc.gnu.org>2015-02-16 13:56:55 -0700
commit215f8d9eb34eace83aad9261db15b2478ac734b1 (patch)
treea6439f13a3fb8cf10f44d005b6dd6a2fd8999477 /gcc/tree-vrp.c
parented89033d7c15db7bbc3c6c6dfb9495ac263b3a73 (diff)
downloadgcc-215f8d9eb34eace83aad9261db15b2478ac734b1.zip
gcc-215f8d9eb34eace83aad9261db15b2478ac734b1.tar.gz
gcc-215f8d9eb34eace83aad9261db15b2478ac734b1.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 real 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: r220743
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index dad1830..d996bcc 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -10176,13 +10176,20 @@ identify_jump_threads (void)
/* We only care about blocks ending in a COND_EXPR. While there
may be some value in handling SWITCH_EXPR here, I doubt it's
terribly important. */
- last = gsi_stmt (gsi_last_bb (bb));
+ last = gsi_stmt (gsi_last_nondebug_bb (bb));
/* 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)))