Fix calls.c for a _complex type (PR ipa/80104).
authorMartin Liska <mliska@suse.cz>
Tue, 28 Mar 2017 09:01:57 +0000 (11:01 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Tue, 28 Mar 2017 09:01:57 +0000 (09:01 +0000)
2017-03-28  Martin Liska  <mliska@suse.cz>

PR ipa/80104
* cgraphunit.c (cgraph_node::expand_thunk): Mark argument of a
thunk call as DECL_GIMPLE_REG_P when vector or complex type.
2017-03-28  Martin Liska  <mliska@suse.cz>

PR ipa/80104
* gcc.dg/ipa/pr80104.c: New test.

From-SVN: r246525

gcc/ChangeLog
gcc/cgraphunit.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/ipa/pr80104.c [new file with mode: 0644]

index 4864d75bb6672a3d880278e785ae885a219c9b5c..27e7b8f0a75210f8cccbfae96a5630e9f1042303 100644 (file)
@@ -1,3 +1,9 @@
+2017-03-28  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/80104
+       * cgraphunit.c (cgraph_node::expand_thunk): Mark argument of a
+       thunk call as DECL_GIMPLE_REG_P when vector or complex type.
+
 2017-03-28  Claudiu Zissulescu  <claziss@synopsys.com>
            Thomas Petazzoni  <thomas.petazzoni@free-electrons.com>
 
index c82a88a599ca61b068dd9783d2a6158163809b37..8635e3bd0e91cb9346784ee3fd2cddd6e4fb5a9b 100644 (file)
@@ -1806,6 +1806,10 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
        for (; i < nargs; i++, arg = DECL_CHAIN (arg))
          {
            tree tmp = arg;
+           if (VECTOR_TYPE_P (TREE_TYPE (arg))
+               || TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE)
+             DECL_GIMPLE_REG_P (arg) = 1;
+
            if (!is_gimple_val (arg))
              {
                tmp = create_tmp_reg (TYPE_MAIN_VARIANT
index 93c9f9efed492afcd1abcab80d93a4224157bb44..a896f753719897c3f92cf5f886f3a9f1066c6755 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-28  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/80104
+       * gcc.dg/ipa/pr80104.c: New test.
+
 2017-03-28  Marek Polacek  <polacek@redhat.com>
 
        PR sanitizer/80067
diff --git a/gcc/testsuite/gcc.dg/ipa/pr80104.c b/gcc/testsuite/gcc.dg/ipa/pr80104.c
new file mode 100644 (file)
index 0000000..7e75c99
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR ipa/80104 */
+/* { dg-do compile } */
+/* { dg-options "-fipa-icf" } */
+
+float
+a (_Complex float b)
+{
+  return *&b;
+}
+
+float
+c (_Complex float b)
+{
+  return (&b)[0];
+}