summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-18 10:23:21 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-18 10:23:21 +0000
commit0be0fe66ae0a1834ceb5096648f622ff7145f0c2 (patch)
tree45cbeec18a8644392aadc85ed81c832a661162ee
parentba1b7ee1e5de97c84b7ee949ed70a38135c2db48 (diff)
downloadgcc-0be0fe66ae0a1834ceb5096648f622ff7145f0c2.tar.gz
PR tree-optimization/68157
* tree-ssa-reassoc.c (attempt_builtin_powi): Set uid of pow_stmt or mul_stmt from stmt's uid. (reassociate_bb): Set uid of mul_stmt from stmt's uid. * g++.dg/opt/pr68157.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230530 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/opt/pr68157.C18
-rw-r--r--gcc/tree-ssa-reassoc.c5
4 files changed, 35 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 360bbc83af2..fb1db057ae7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-11-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/68157
+ * tree-ssa-reassoc.c (attempt_builtin_powi): Set uid of
+ pow_stmt or mul_stmt from stmt's uid.
+ (reassociate_bb): Set uid of mul_stmt from stmt's uid.
+
2015-11-18 Martin Liska <mliska@suse.cz>
* haifa-sched.c (haifa_finish_h_i_d): Release reg_set_list.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5be70e2f85b..08f910427ac 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/68157
+ * g++.dg/opt/pr68157.C: New test.
+
2015-11-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/67790
diff --git a/gcc/testsuite/g++.dg/opt/pr68157.C b/gcc/testsuite/g++.dg/opt/pr68157.C
new file mode 100644
index 00000000000..1d723486fb7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr68157.C
@@ -0,0 +1,18 @@
+// PR tree-optimization/68157
+// { dg-do compile }
+// { dg-options "-Ofast" }
+
+double a, b, c, d;
+int h, foo ();
+
+void
+bar ()
+{
+ while (foo ())
+ {
+ double e = b * a * a;
+ double f = b * d;
+ if (h)
+ c = e + f;
+ }
+}
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 7be934d9dde..dfd0da1a123 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -4441,6 +4441,7 @@ attempt_builtin_powi (gimple *stmt, vec<operand_entry *> *ops)
power));
gimple_call_set_lhs (pow_stmt, iter_result);
gimple_set_location (pow_stmt, gimple_location (stmt));
+ gimple_set_uid (pow_stmt, gimple_uid (stmt));
gsi_insert_before (&gsi, pow_stmt, GSI_SAME_STMT);
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -4524,6 +4525,7 @@ attempt_builtin_powi (gimple *stmt, vec<operand_entry *> *ops)
mul_stmt = gimple_build_assign (target_ssa, MULT_EXPR,
op1, op2);
gimple_set_location (mul_stmt, gimple_location (stmt));
+ gimple_set_uid (mul_stmt, gimple_uid (stmt));
gsi_insert_before (&gsi, mul_stmt, GSI_SAME_STMT);
rf1->repr = target_ssa;
@@ -4541,6 +4543,7 @@ attempt_builtin_powi (gimple *stmt, vec<operand_entry *> *ops)
power));
gimple_call_set_lhs (pow_stmt, iter_result);
gimple_set_location (pow_stmt, gimple_location (stmt));
+ gimple_set_uid (pow_stmt, gimple_uid (stmt));
gsi_insert_before (&gsi, pow_stmt, GSI_SAME_STMT);
}
@@ -4552,6 +4555,7 @@ attempt_builtin_powi (gimple *stmt, vec<operand_entry *> *ops)
mul_stmt = gimple_build_assign (new_result, MULT_EXPR,
result, iter_result);
gimple_set_location (mul_stmt, gimple_location (stmt));
+ gimple_set_uid (mul_stmt, gimple_uid (stmt));
gsi_insert_before (&gsi, mul_stmt, GSI_SAME_STMT);
gimple_set_visited (mul_stmt, true);
result = new_result;
@@ -4908,6 +4912,7 @@ reassociate_bb (basic_block bb)
mul_stmt = gimple_build_assign (lhs, MULT_EXPR,
powi_result, target_ssa);
gimple_set_location (mul_stmt, gimple_location (stmt));
+ gimple_set_uid (mul_stmt, gimple_uid (stmt));
gsi_insert_after (&gsi, mul_stmt, GSI_NEW_STMT);
}
}