From ecef0d345848dedec252f86f6d528c0536b30e69 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 25 Mar 2019 12:15:59 +0000 Subject: [PATCH] re PR tree-optimization/89802 ([9 Regresssion] ICE: verify_gimple failed (error: dead STMT in EH table)) 2019-03-25 Richard Biener PR tree-optimization/89802 * tree-ssa-math-opts.c (convert_mult_to_fma_1): Properly move EH data to folded stmt. * g++.dg/tree-ssa/pr89802.C: New testcase. From-SVN: r269913 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/tree-ssa/pr89802.C | 28 +++++++++++++++++++++++++ gcc/tree-ssa-math-opts.c | 7 ++++++- 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/tree-ssa/pr89802.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9e35e82025a..e7fbaeba97f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-25 Richard Biener + + PR tree-optimization/89802 + * tree-ssa-math-opts.c (convert_mult_to_fma_1): Properly + move EH data to folded stmt. + 2019-03-25 Andreas Krebbel * config/s390/s390-builtin-types.def: Remove few unused types and diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 96b23c0403f..ef7ae1b1c4c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-25 Richard Biener + + PR tree-optimization/89802 + * g++.dg/tree-ssa/pr89802.C: New testcase. + 2019-03-25 Jakub Jelinek PR c++/60702 diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr89802.C b/gcc/testsuite/g++.dg/tree-ssa/pr89802.C new file mode 100644 index 00000000000..f93f8cdac92 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr89802.C @@ -0,0 +1,28 @@ +// { dg-do compile } +// { dg-options "-O2 -fnon-call-exceptions" } +// { dg-additional-options "-mfma" { target x86_64-*-* i?86-*-* } } + +struct ef +{ + ef (double xy) : m6 (xy) + { + } + + ~ef () + { + } + + double m6; +}; + +ef +operator- (ef &db, ef oa) +{ + return db.m6 - oa.m6; +} + +ef +vu (ef &db) +{ + return db - ef (db.m6 * 1.1); +} diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index cb8a9143833..8902d85a7c9 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -2917,8 +2917,13 @@ convert_mult_to_fma_1 (tree mul_result, tree op1, tree op2) gsi_replace (&gsi, fma_stmt, true); /* Follow all SSA edges so that we generate FMS, FNMA and FNMS regardless of where the negation occurs. */ + gimple *orig_stmt = gsi_stmt (gsi); if (fold_stmt (&gsi, follow_all_ssa_edges)) - update_stmt (gsi_stmt (gsi)); + { + if (maybe_clean_or_replace_eh_stmt (orig_stmt, gsi_stmt (gsi))) + gcc_unreachable (); + update_stmt (gsi_stmt (gsi)); + } if (dump_file && (dump_flags & TDF_DETAILS)) { -- 2.30.2