Commit 22bd385b by Mark Mitchell Committed by Mark Mitchell

re PR rtl-optimization/5079 (Reference to static const int not eliminated during optimization)

	PR optimization/5079
	* call.c (build_conditional_expr): Use decl_constant_value to
	simplify the arguments.

	PR optimization/5079
	* g++.dg/opt/static3.C: New test.

From-SVN: r70881
parent 45dff86e
2003-08-28 Mark Mitchell <mark@codesourcery.com>
PR optimization/5079
* call.c (build_conditional_expr): Use decl_constant_value to
simplify the arguments.
2003-08-26 Dan Nicolaescu <dann@ics.uci.edu>
* parser.c (struct cp_token): Use enum bitfields.
......
......@@ -3358,6 +3358,8 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3)
}
valid_operands:
arg2 = decl_constant_value (arg2);
arg3 = decl_constant_value (arg3);
result = fold (build (COND_EXPR, result_type, arg1, arg2, arg3));
/* We can't use result_type below, as fold might have returned a
throw_expr. */
......
2003-08-28 Mark Mitchell <mark@codesourcery.com>
PR optimization/5079
* g++.dg/opt/static3.C: New test.
2003-08-27 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* gcc.misc-tests/gcov-10b.c: New test.
......
// { dg-do link }
class Foo {
public:
// No out-of-class definition is provided for these class members.
// That's technically a violation of the standard, but no diagnostic
// is required, and, as a QOI issue, we should optimize away all
// references.
static const int erf = 0;
static const int foo = 1;
};
int one()
{
return Foo::foo;
}
int two()
{
return Foo::foo + Foo::erf;
}
int three(int x)
{
return x ? Foo::erf : Foo::foo;
}
int i;
int main ()
{
one ();
two ();
three (i);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment