Limit depth for all GORI expressions.
Apply the logical_depth limit ranger uses to all stmts with multiple ssa-names to avoid excessive outgoing calculations. gcc/ PR tree-optimization/103254 * gimple-range-gori.cc (range_def_chain::get_def_chain): Limit the depth for all statements with multple ssa names. gcc/testsuite/ * gcc.dg/pr103254.c: New.
This commit is contained in:
parent
f47870e6a2
commit
ee448a523d
2 changed files with 34 additions and 11 deletions
|
@ -331,7 +331,6 @@ range_def_chain::get_def_chain (tree name)
|
|||
{
|
||||
tree ssa1, ssa2, ssa3;
|
||||
unsigned v = SSA_NAME_VERSION (name);
|
||||
bool is_logical = false;
|
||||
|
||||
// If it has already been processed, just return the cached value.
|
||||
if (has_def_chain (name))
|
||||
|
@ -348,15 +347,6 @@ range_def_chain::get_def_chain (tree name)
|
|||
gimple *stmt = SSA_NAME_DEF_STMT (name);
|
||||
if (gimple_range_handler (stmt))
|
||||
{
|
||||
is_logical = is_gimple_logical_p (stmt);
|
||||
// Terminate the def chains if we see too many cascading logical stmts.
|
||||
if (is_logical)
|
||||
{
|
||||
if (m_logical_depth == param_ranger_logical_depth)
|
||||
return NULL;
|
||||
m_logical_depth++;
|
||||
}
|
||||
|
||||
ssa1 = gimple_range_ssa_p (gimple_range_operand1 (stmt));
|
||||
ssa2 = gimple_range_ssa_p (gimple_range_operand2 (stmt));
|
||||
ssa3 = NULL_TREE;
|
||||
|
@ -376,6 +366,14 @@ range_def_chain::get_def_chain (tree name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// Terminate the def chains if we see too many cascading stmts.
|
||||
if (m_logical_depth == param_ranger_logical_depth)
|
||||
return NULL;
|
||||
|
||||
// Increase the depth if we have a pair of ssa-names.
|
||||
if (ssa1 && ssa2)
|
||||
m_logical_depth++;
|
||||
|
||||
register_dependency (name, ssa1, gimple_bb (stmt));
|
||||
register_dependency (name, ssa2, gimple_bb (stmt));
|
||||
register_dependency (name, ssa3, gimple_bb (stmt));
|
||||
|
@ -383,7 +381,7 @@ range_def_chain::get_def_chain (tree name)
|
|||
if (!ssa1 && !ssa2 & !ssa3)
|
||||
set_import (m_def_chain[v], name, NULL);
|
||||
|
||||
if (is_logical)
|
||||
if (ssa1 && ssa2)
|
||||
m_logical_depth--;
|
||||
|
||||
return m_def_chain[v].bm;
|
||||
|
|
25
gcc/testsuite/gcc.dg/pr103254.c
Normal file
25
gcc/testsuite/gcc.dg/pr103254.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O3" } */
|
||||
/* { dg-timeout 10 } */
|
||||
|
||||
short int i;
|
||||
|
||||
void
|
||||
foo (void)
|
||||
{
|
||||
for (i = 1; i < 2; i += 4)
|
||||
{
|
||||
int j;
|
||||
|
||||
for (j = 0; j < 5; j += 4)
|
||||
{
|
||||
int k;
|
||||
|
||||
for (k = 0; k < 68; k += 4)
|
||||
{
|
||||
i &= j;
|
||||
j &= i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue