aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@nildram.co.uk>2007-10-09 11:04:46 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2007-10-09 11:04:46 +0000
commit94172876940bd493e6c193e46dfacaa77d1f8606 (patch)
tree380064bdc5ece64e0334820d84d2da25451f50cd /gcc
parentedbed3d31e8f6981f4bf4692c132b95081ab5112 (diff)
downloadgcc-94172876940bd493e6c193e46dfacaa77d1f8606.zip
gcc-94172876940bd493e6c193e46dfacaa77d1f8606.tar.gz
gcc-94172876940bd493e6c193e46dfacaa77d1f8606.tar.bz2
re PR tree-optimization/33615 (Hoisting of potentially-throwing values for -fnon-call-exceptions)
gcc/ PR tree-optimization/33615 * tree-ssa-loop-im.c (movement_possibility): Return MOVE_IMPOSSIBLE if the rhs might throw. gcc/testsuite/ PR tree-optimization/33615 * g++.dg/tree-ssa/pr33615.C: New test. From-SVN: r129163
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr33615.C20
-rw-r--r--gcc/tree-ssa-loop-im.c3
4 files changed, 33 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4717ca8..1d66ea3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-09 Richard Sandiford <rsandifo@nildram.co.uk>
+
+ PR tree-optimization/33615
+ * tree-ssa-loop-im.c (movement_possibility): Return MOVE_IMPOSSIBLE
+ if the rhs might throw.
+
2007-10-09 Jan Hubicka <jh@suse.cz>
* invoke.texi (align-threshold, align-loop-iterations): Document.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0b1e916..f6665d5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-10-09 Richard Sandiford <rsandifo@nildram.co.uk>
+
+ PR tree-optimization/33615
+ * g++.dg/tree-ssa/pr33615.C: New test.
+
2007-10-08 Alexandre Oliva <aoliva@redhat.com>
PR tree-optimization/33572
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr33615.C b/gcc/testsuite/g++.dg/tree-ssa/pr33615.C
new file mode 100644
index 0000000..e8a5369
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr33615.C
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fnon-call-exceptions -fdump-tree-lim-details -w" } */
+
+extern volatile int y;
+
+double
+foo (double a, int x)
+{
+ while (x--)
+ {
+ y++;
+ a += 1.0 / 0.0;
+ }
+ return a;
+}
+
+// The expression 1.0 / 0.0 should not be treated as a loop invariant
+// if it may throw an exception.
+// { dg-final { scan-tree-dump-times "invariant up to" 0 "lim" } }
+// { dg-final { cleanup-tree-dump "lim" } }
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index d2ab41c..83ad70c 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -260,7 +260,8 @@ movement_possibility (tree stmt)
rhs = GIMPLE_STMT_OPERAND (stmt, 1);
- if (TREE_SIDE_EFFECTS (rhs))
+ if (TREE_SIDE_EFFECTS (rhs)
+ || tree_could_throw_p (rhs))
return MOVE_IMPOSSIBLE;
if (TREE_CODE (lhs) != SSA_NAME