aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
diff options
context:
space:
mode:
authorAndrew Pinski <apinski@cavium.com>2017-06-30 20:40:38 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2017-06-30 13:40:38 -0700
commitfb6a764dfdb74bbd0acfb7dc8d95a98286637d8a (patch)
treebadd638916d579f151c94ab4bc771942166022d3 /gcc/tree-if-conv.c
parent08fb13163ce5e7dcf61c3ce898a63bb54f1b6d3d (diff)
tree-if-conv.c (predicate_scalar_phi): Update new_stmt if fold_stmt returned true.
2017-06-30 Andrew Pinski <apinski@cavium.com> * tree-if-conv.c (predicate_scalar_phi): Update new_stmt if fold_stmt returned true. 2017-06-30 Andrew Pinski <apinski@cavium.com> * gcc.dg/torture/pr81245.c: New testcase. From-SVN: r249854
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r--gcc/tree-if-conv.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index b1f06a83fb2..dbacc6e1950 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1853,8 +1853,11 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi)
new_stmt = gimple_build_assign (res, rhs);
gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
gimple_stmt_iterator new_gsi = gsi_for_stmt (new_stmt);
- fold_stmt (&new_gsi, ifcvt_follow_ssa_use_edges);
- update_stmt (new_stmt);
+ if (fold_stmt (&new_gsi, ifcvt_follow_ssa_use_edges))
+ {
+ new_stmt = gsi_stmt (new_gsi);
+ update_stmt (new_stmt);
+ }
if (dump_file && (dump_flags & TDF_DETAILS))
{