summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-08 19:11:55 +0000
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-08 19:11:55 +0000
commitd7eb56defdea58124864988b36586d58936dfe5f (patch)
tree4c1ab0966a4b31bb8348a8c1f209ef546193bbac
parent59653f01a8b8a7156962be7216653d0ce0062d79 (diff)
downloadlinaro-gcc-d7eb56defdea58124864988b36586d58936dfe5f.tar.gz
linaro-gcc-d7eb56defdea58124864988b36586d58936dfe5f.tar.bz2
linaro-gcc-d7eb56defdea58124864988b36586d58936dfe5f.zip
PR tree-optimization/20139
* tree-cfg.c (remove_bb): Check in_ssa_p before calling release_defs. * tree-optimize.c (execute_cleanup_cfg_post_optimizing): Call fold_cond_expr_cond. * tree-ssanames.c (release_defs): Assert in_ssa_p. * tree.c (upper_bound_in_type, lower_bound_in_type): Rewrite. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101787 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr20139.c23
-rw-r--r--gcc/tree-cfg.c7
-rw-r--r--gcc/tree-optimize.c1
-rw-r--r--gcc/tree-ssanames.c4
6 files changed, 47 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index db2a8ea62d7..adceec9b310 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -7,6 +7,14 @@
(lower_bound_in_type): Fix calculations for casting to a
non-wider signed type.
+ PR tree-optimization/20139
+ * tree-cfg.c (remove_bb): Check in_ssa_p before calling
+ release_defs.
+ * tree-optimize.c (execute_cleanup_cfg_post_optimizing): Call
+ fold_cond_expr_cond.
+ * tree-ssanames.c (release_defs): Assert in_ssa_p.
+ * tree.c (upper_bound_in_type, lower_bound_in_type): Rewrite.
+
2005-07-08 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/22356
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ac82940d427..862e457baff 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-08 Kazu Hirata <kazu@codesourcery.com>
+
+ PR tree-optimization/20139
+ * gcc.dg/tree-ssa/pr20139.c: New.
+
2005-07-08 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/22356
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20139.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20139.c
new file mode 100644
index 00000000000..054e4b2081c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20139.c
@@ -0,0 +1,23 @@
+/* PR tree-optimization/20139
+ This testcase is derived from gcc.dg/20020720-1.c. Here we check
+ that the optimization happens at tree level. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-final_cleanup" } */
+
+extern double fabs (double);
+extern void link_error (void);
+
+void
+foo (double x)
+{
+ double p, q;
+
+ p = fabs (x);
+ q = 0.0;
+ if (p < q)
+ link_error ();
+}
+
+/* { dg-final { scan-tree-dump-times "link_error" 0 "final_cleanup" } } */
+/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 8dd16ce844b..bfbf5a5fd80 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1981,7 +1981,12 @@ remove_bb (basic_block bb)
}
else
{
- release_defs (stmt);
+ /* Release SSA definitions if we are in SSA. Note that we
+ may be called when not in SSA. For example,
+ final_cleanup calls this function via
+ cleanup_tree_cfg. */
+ if (in_ssa_p)
+ release_defs (stmt);
bsi_remove (&i);
}
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index 4b23a82fbf0..c29c3c6a422 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -132,6 +132,7 @@ struct tree_opt_pass pass_cleanup_cfg =
static void
execute_cleanup_cfg_post_optimizing (void)
{
+ fold_cond_expr_cond ();
cleanup_tree_cfg ();
cleanup_dead_labels ();
group_case_labels ();
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index bf5ffef9e5e..f794eaec6be 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -289,6 +289,10 @@ release_defs (tree stmt)
tree def;
ssa_op_iter iter;
+ /* Make sure that we are in SSA. Otherwise, operand cache may point
+ to garbage. */
+ gcc_assert (in_ssa_p);
+
FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_ALL_DEFS)
if (TREE_CODE (def) == SSA_NAME)
release_ssa_name (def);