mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-23 01:20:31 +08:00
tree-vrp.c (simplify_stmt_for_jump_threading): Try to simplify assignments too.
* tree-vrp.c (simplify_stmt_for_jump_threading): Try to simplify assignments too. If the RHS collapses to a singleton range, then return the value for the range. * gcc.dg/tree-ssa/ssa-vrp-thread-1.c: New test. From-SVN: r201898
This commit is contained in:
parent
8724cfdd3b
commit
5562e26eaf
@ -1,3 +1,9 @@
|
||||
2013-08-21 Jeff Law <law@redhat.com>
|
||||
|
||||
* tree-vrp.c (simplify_stmt_for_jump_threading): Try to
|
||||
simplify assignments too. If the RHS collapses to a singleton
|
||||
range, then return the value for the range.
|
||||
|
||||
2013-08-21 Kirill Yukhin <kirill.yukhin@intel.com>
|
||||
|
||||
* config/i386/sse.md (V16): Rename to...
|
||||
|
@ -1,3 +1,7 @@
|
||||
2013-08-21 Jeff Law <law@redhat.com>
|
||||
|
||||
* gcc.dg/tree-ssa/ssa-vrp-thread-1.c: New test.
|
||||
|
||||
2013-08-21 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/56134
|
||||
|
31
gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c
Normal file
31
gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-vrp1-details" } */
|
||||
|
||||
|
||||
struct basic_block_def;
|
||||
typedef struct basic_block_def *basic_block;
|
||||
enum gimple_code
|
||||
{
|
||||
LAST_AND_UNUSED_GIMPLE_CODE
|
||||
};
|
||||
struct omp_region
|
||||
{
|
||||
struct omp_region *outer;
|
||||
basic_block cont;
|
||||
};
|
||||
void
|
||||
build_omp_regions_1 (basic_block bb, struct omp_region *parent,
|
||||
unsigned char single_tree, enum gimple_code code)
|
||||
{
|
||||
if (code == 25)
|
||||
parent = parent->outer;
|
||||
else if (code == 42)
|
||||
parent->cont = bb;
|
||||
if (single_tree && !parent)
|
||||
return;
|
||||
oof ();
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-times "Threaded" 1 "vrp1" } } */
|
||||
/* { dg-final { cleanup-tree-dump "vrp1" } } */
|
||||
|
@ -9273,15 +9273,27 @@ static vec<tree> equiv_stack;
|
||||
static tree
|
||||
simplify_stmt_for_jump_threading (gimple stmt, gimple within_stmt)
|
||||
{
|
||||
/* We only use VRP information to simplify conditionals. This is
|
||||
overly conservative, but it's unclear if doing more would be
|
||||
worth the compile time cost. */
|
||||
if (gimple_code (stmt) != GIMPLE_COND)
|
||||
return NULL;
|
||||
if (gimple_code (stmt) == GIMPLE_COND)
|
||||
return vrp_evaluate_conditional (gimple_cond_code (stmt),
|
||||
gimple_cond_lhs (stmt),
|
||||
gimple_cond_rhs (stmt), within_stmt);
|
||||
|
||||
return vrp_evaluate_conditional (gimple_cond_code (stmt),
|
||||
gimple_cond_lhs (stmt),
|
||||
gimple_cond_rhs (stmt), within_stmt);
|
||||
if (gimple_code (stmt) == GIMPLE_ASSIGN)
|
||||
{
|
||||
value_range_t new_vr = VR_INITIALIZER;
|
||||
tree lhs = gimple_assign_lhs (stmt);
|
||||
|
||||
if (TREE_CODE (lhs) == SSA_NAME
|
||||
&& (INTEGRAL_TYPE_P (TREE_TYPE (lhs))
|
||||
|| POINTER_TYPE_P (TREE_TYPE (lhs))))
|
||||
{
|
||||
extract_range_from_assignment (&new_vr, stmt);
|
||||
if (range_int_cst_singleton_p (&new_vr))
|
||||
return new_vr.min;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
/* Blocks which have more than one predecessor and more than
|
||||
|
Loading…
x
Reference in New Issue
Block a user