re PR tree-optimization/14703 (Inadequate optimization of inline templated functions, infinite loop in ipa-reference and memory hog)
PR tree-optimization/14703 * tree-ssa-live.c (remove_unused_scope_block_p): Remove ignored declarations. * passes.c (init_optimization_passes): Recompute inline parameters. * g++.dg/tree-ssa-pr14703.C: New testcase. From-SVN: r140068
This commit is contained in:
parent
7a687b2265
commit
b91bc3493e
5 changed files with 67 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2008-09-06 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
PR tree-optimization/14703
|
||||
* tree-ssa-live.c (remove_unused_scope_block_p): Remove ignored declarations.
|
||||
* passes.c (init_optimization_passes): Recompute inline parameters.
|
||||
|
||||
2008-09-06 Richard Sandiford <rdsandiford@googlemail.com>
|
||||
|
||||
* config/mips/mips.c (mips_function_ok_for_sibcall): Check for
|
||||
|
|
|
@ -565,6 +565,7 @@ init_optimization_passes (void)
|
|||
}
|
||||
NEXT_PASS (pass_release_ssa_names);
|
||||
NEXT_PASS (pass_rebuild_cgraph_edges);
|
||||
NEXT_PASS (pass_inline_parameters);
|
||||
}
|
||||
NEXT_PASS (pass_ipa_increase_alignment);
|
||||
NEXT_PASS (pass_ipa_matrix_reorg);
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2008-09-06 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* g++.dg/tree-ssa-pr14703.C: New testcase.
|
||||
|
||||
2008-09-06 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR fortran/36153
|
||||
|
|
49
gcc/testsuite/g++.dg/tree-ssa/pr14703.C
Normal file
49
gcc/testsuite/g++.dg/tree-ssa/pr14703.C
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-optimized -fno-ipa-reference" } */
|
||||
#include <iostream>
|
||||
|
||||
namespace {
|
||||
template <unsigned long long L> class fib {
|
||||
public:
|
||||
static const unsigned long long value = fib<L - 1>::value + fib<L - 2>::value;
|
||||
};
|
||||
|
||||
template <> class fib<0> {
|
||||
public:
|
||||
static const unsigned long long value = 1;
|
||||
};
|
||||
|
||||
template <> class fib<1> {
|
||||
public:
|
||||
static const unsigned long long value = 1;
|
||||
};
|
||||
|
||||
template<unsigned long long L> inline unsigned long long fibconst()
|
||||
{
|
||||
return fibconst<L - 1>() + fibconst<L - 2>();
|
||||
}
|
||||
|
||||
template <> inline unsigned long long fibconst<0>()
|
||||
{
|
||||
return 1ull;
|
||||
}
|
||||
|
||||
template <> inline unsigned long long fibconst<1>()
|
||||
{
|
||||
return 1ull;
|
||||
}
|
||||
|
||||
template <> inline unsigned long long fibconst<2>()
|
||||
{
|
||||
return 2ull;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
::std::cerr << "fib<90>::value == " << fib<90>::value << "\n";
|
||||
::std::cerr << "fibcst<90>() == " << fibconst<90>() << "\n";
|
||||
}
|
||||
// { dg-final { scan-tree-dump-not "fibconst" "optimized" } }
|
||||
// { dg-final { cleanup-tree-dump "optimized" } }
|
|
@ -489,6 +489,13 @@ remove_unused_scope_block_p (tree scope)
|
|||
if (TREE_CODE (*t) == FUNCTION_DECL)
|
||||
unused = false;
|
||||
|
||||
/* Remove everything we don't generate debug info for. */
|
||||
else if (DECL_IGNORED_P (*t))
|
||||
{
|
||||
*t = TREE_CHAIN (*t);
|
||||
next = t;
|
||||
}
|
||||
|
||||
/* When we are outputting debug info, we usually want to output
|
||||
info about optimized-out variables in the scope blocks.
|
||||
Exception are the scope blocks not containing any instructions
|
||||
|
|
Loading…
Add table
Reference in a new issue