summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-21 06:51:25 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-21 06:51:25 +0000
commita195a2e0542f43ead546c488f0f7e687d2837570 (patch)
tree814b2815853aadb05602d3e230648d6115fe2702 /gcc
parent1001e7472ed1a8da038444e2d1d8805a5e567a78 (diff)
downloadgcc-a195a2e0542f43ead546c488f0f7e687d2837570.tar.gz
PR rtl-optimization/22167
* gcse.c (hoist_code): Fix hoist_exprs[] check. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102219 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gcse.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/opt/pr22167.C32
4 files changed, 43 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c58dcebfb16..e5e533f9f11 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+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>
* config/rs6000/lynx.h: Mark __do_global_ctors_aux and
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 5099a08d7ba..e2d35e21286 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4898,7 +4898,7 @@ hoist_code (void)
insn_inserted_p = 0;
/* 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 look at every block BB dominates to see if it
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f701137d2fd..99b9c799651 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+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>
PR c++/2922
diff --git a/gcc/testsuite/g++.dg/opt/pr22167.C b/gcc/testsuite/g++.dg/opt/pr22167.C
new file mode 100644
index 00000000000..07af744624a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr22167.C
@@ -0,0 +1,32 @@
+// 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];
+}