From a162f3af802f4f3dab5a53e6864600e6c38582d7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 8 Feb 2016 21:07:56 +0100 Subject: [PATCH] re PR tree-optimization/69209 (ICE at -Os and above on x86_64-linux-gnu (verify_gimple failed)) PR tree-optimization/69209 * ipa-split.c (split_function): If split part is not returning retval, retval has gimple type but is not gimple value, force it into a SSA_NAME first. * gcc.c-torture/compile/pr69209.c: New test. From-SVN: r233228 --- gcc/ChangeLog | 7 +++++ gcc/ipa-split.c | 16 ++++++++++- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.c-torture/compile/pr69209.c | 28 +++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr69209.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b0dd2c3842e1..08edb4495dd6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-02-08 Jakub Jelinek + + PR tree-optimization/69209 + * ipa-split.c (split_function): If split part is not + returning retval, retval has gimple type but is not + gimple value, force it into a SSA_NAME first. + 2016-02-08 Nicklas Bo Jensen * doc/tree-ssa.texi (Preserving the virtual SSA form): Remove diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index 9ecc28246986..929119abd7e9 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -1628,8 +1628,22 @@ split_function (basic_block return_bb, struct split_point *split_point, gimple_call_set_lhs (call, build_simple_mem_ref (retval)); else gimple_call_set_lhs (call, retval); + gsi_insert_after (&gsi, call, GSI_NEW_STMT); + } + else + { + gsi_insert_after (&gsi, call, GSI_NEW_STMT); + if (retval + && is_gimple_reg_type (TREE_TYPE (retval)) + && !is_gimple_val (retval)) + { + gassign *g + = gimple_build_assign (make_ssa_name (TREE_TYPE (retval)), + retval); + retval = gimple_assign_lhs (g); + gsi_insert_after (&gsi, g, GSI_NEW_STMT); + } } - gsi_insert_after (&gsi, call, GSI_NEW_STMT); /* Build bndret call to obtain returned bounds. */ if (retbnd) chkp_insert_retbnd_call (retbnd, retval, &gsi); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9f629d6f55e2..d958e5d4814a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-02-08 Jakub Jelinek + + PR tree-optimization/69209 + * gcc.c-torture/compile/pr69209.c: New test. + 2016-02-08 Jeff Law PR tree-optimization/68541 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr69209.c b/gcc/testsuite/gcc.c-torture/compile/pr69209.c new file mode 100644 index 000000000000..fd8046f217d1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr69209.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/69209 */ + +int a, c, *d, e; + +void foo (void) __attribute__ ((__noreturn__)); + +int +bar (void) +{ + int f; + if (a) + { + if (e) + foo (); + foo (); + } + if (d != &f) + foo (); + if (!c) + foo (); + return f; +} + +void +baz () +{ + bar (); +} -- 2.47.2