Commit cb83c2ec by Richard Sandiford Committed by Richard Sandiford

re PR rtl-optimization/22167 (Strange optimization bug when using -Os)

	PR rtl-optimization/22167
	* gcse.c (hoist_code): Fix hoist_exprs[] check.

From-SVN: r102219
parent 5e5cbbfb
2005-07-21 Richard Sandiford <richard@codesourcery.com>
PR rtl-optimization/22167
* gcse.c (hoist_code): Fix hoist_exprs[] check.
2005-07-20 Adam Nemet <anemet@lnxw.com> 2005-07-20 Adam Nemet <anemet@lnxw.com>
* config/rs6000/lynx.h: Mark __do_global_ctors_aux and * config/rs6000/lynx.h: Mark __do_global_ctors_aux and
......
...@@ -4898,7 +4898,7 @@ hoist_code (void) ...@@ -4898,7 +4898,7 @@ hoist_code (void)
insn_inserted_p = 0; insn_inserted_p = 0;
/* These tests should be the same as the tests above. */ /* These tests should be the same as the tests above. */
if (TEST_BIT (hoist_vbeout[bb->index], i)) if (TEST_BIT (hoist_exprs[bb->index], i))
{ {
/* We've found a potentially hoistable expression, now /* We've found a potentially hoistable expression, now
we look at every block BB dominates to see if it we look at every block BB dominates to see if it
......
2005-07-21 Richard Sandiford <richard@codesourcery.com>
PR rtl-optimization/22167
* g++.dg/opt/pr22167.C: New test.
2005-07-20 Douglas Gregor <doug.gregor@gmail.com> 2005-07-20 Douglas Gregor <doug.gregor@gmail.com>
PR c++/2922 PR c++/2922
......
// Derived from PR22167, which failed on some RISC targets. The call to
// foo() has two successors, one normal and one exceptional, and both
// successors use &a[0] and x. Expressions involving &a[0] can be hoisted
// before the call but those involving x cannot.
// { dg-options "-Os" }
// { dg-do run }
int a[4];
struct S {
S() : x (0) {}
~S() { a[0] = x; }
int x;
};
void
foo (int *x)
{
if (*x == 1)
throw 1;
*x = 1;
}
int
main()
{
S s;
foo (&s.x);
if (a[0] == s.x)
a[0]++;
return a[0];
}
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