2007-10-09 Richard Sandiford <rsandifo@nildram.co.uk>
PR tree-optimization/33615
+ * tree-ssa-pre.c (compute_avail): Don't call make_values_for_stmt
+ if the statement might throw. Fix formatting.
+
+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 Richard Sandiford <rsandifo@nildram.co.uk>
PR tree-optimization/33615
+ * g++.dg/tree-ssa/pr33615-2.C: New test.
+
+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>
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fnon-call-exceptions -fdump-tree-pre-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 "Replaced 1\\\.0e\\\+0 / 0\\\.0" 0 "pre" } }
+// { dg-final { cleanup-tree-dump "pre" } }
}
else if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
- && !ann->has_volatile_ops
- && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME
- && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI
- (GIMPLE_STMT_OPERAND (stmt, 0)))
+ && !ann->has_volatile_ops
+ && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME
+ && (!SSA_NAME_OCCURS_IN_ABNORMAL_PHI
+ (GIMPLE_STMT_OPERAND (stmt, 0)))
+ && !tree_could_throw_p (stmt))
{
if (make_values_for_stmt (stmt, block))
continue;