]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR tree-optimization/69209
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Feb 2016 20:07:56 +0000 (20:07 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Feb 2016 20:07:56 +0000 (20:07 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233228 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ipa-split.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr69209.c [new file with mode: 0644]

index b0dd2c3842e1b888ea4725de546958acd713afe3..08edb4495dd6962a623d2cc483abd08449a86b09 100644 (file)
@@ -1,3 +1,10 @@
+2016-02-08  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <nbjensen@gmail.com>
 
        * doc/tree-ssa.texi (Preserving the virtual SSA form): Remove
index 9ecc28246986c5fcddebed5ecab0a171de478733..929119abd7e9f2b4a5c923487ab815335a4b7bcb 100644 (file)
@@ -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);
index 9f629d6f55e2c8a71aae32c8b468e5d2fd90171d..d958e5d4814afd77e642569f67857fdbd3b38b44 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/69209
+       * gcc.c-torture/compile/pr69209.c: New test.
+
 2016-02-08  Jeff Law  <law@redhat.com>
 
        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 (file)
index 0000000..fd8046f
--- /dev/null
@@ -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 ();
+}