public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: "Martin Liška" <mliska@suse.cz>, "GCC Patches" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
Date: Fri, 18 Jan 2019 14:30:00 -0000	[thread overview]
Message-ID: <CAMe9rOo-yq8NsROXyyWq78VD-8gVVq98w2bLGev5A9GHqDZB5A@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOoJF5gLsR13U7RD76ecOAfYjvvv82eg8WzF34VWU77CyQ@mail.gmail.com>

On Fri, Jan 18, 2019 at 6:25 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Jan 17, 2019 at 4:51 AM Richard Biener
> <richard.guenther@gmail.com> wrote:
> >
> > On Thu, Jan 17, 2019 at 12:21 PM Martin Liška <mliska@suse.cz> wrote:
> > >
> > > On 1/16/19 1:06 PM, Richard Biener wrote:
> > > > On Wed, Jan 16, 2019 at 10:20 AM Martin Liška <mliska@suse.cz> wrote:
> > > >>
> > > >> Hi.
> > > >>
> > > >> The patch is about resetting TYPE_MODE of vector types. This is problematic
> > > >> when an inlining among different ISAs happen. Then we end up with a different
> > > >> mode than when it's expected from debug info.
> > > >>
> > > >> When creating a new function decl in target_clones, we must valid_attribute_p early
> > > >> so that the declaration has a proper cl_target_.. node and so that inliner can
> > > >> fix modes.
> > > >>
> > > >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> > > >>
> > > >> Ready to be installed?
> > > >
> > > > I don't like the new failure mode too much.  It looks like
> > > > create_version_clone_with_body
> > > > can fail so why not simply return NULL when
> > > > targetm.target_option.valid_attribute_p
> > > > returns false and handle that case in multi-versioning?
> > > >
> > > > That is,
> > > >
> > > > +  return !seen_error ();
> > > >
> > > > that looks very wrong to me.
> > >
> > > Yep, update patch should be better.
> > >
> > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> > >
> > > Ready to be installed?
> >
> > OK.
> >
> > Thanks,
> > Richard.
> >
> > > Thanks,
> > > Martin
> > >
> > > >
> > > > Richard.
> > > >
> > > >> Thanks,
> > > >> Martin
> > > >>
> > > >> gcc/ChangeLog:
> > > >>
> > > >> 2019-01-16  Martin Liska  <mliska@suse.cz>
> > > >>             Richard Biener  <rguenther@suse.de>
> > > >>
> > > >>         PR middle-end/88587
> > > >>         * cgraph.h (create_version_clone_with_body): Add new argument
> > > >>         with attributes.
> > > >>         * cgraphclones.c (cgraph_node::create_version_clone): Add
> > > >>         DECL_ATTRIBUTES to a newly created decl.  And call
> > > >>         valid_attribute_p so that proper cl_target_optimization_node
> > > >>         is set for the newly created declaration.
> > > >>         * multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES
> > > >>         for declaration.
> > > >>         (expand_target_clones): Do not call valid_attribute_p, it must
> > > >>         be already done.
> > > >>         * tree-inline.c (copy_decl_for_dup_finish): Reset mode for
> > > >>         vector types.
> > > >>
> > > >> gcc/testsuite/ChangeLog:
> > > >>
> > > >> 2019-01-16  Martin Liska  <mliska@suse.cz>
> > > >>
> > > >>         PR middle-end/88587
> > > >>         * g++.target/i386/pr88587.C: New test.
> > > >>         * gcc.target/i386/mvc13.c: New test.
> > > >> ---
> > > >>  gcc/cgraph.h                            |  7 +++++-
> > > >>  gcc/cgraphclones.c                      | 18 +++++++++++++-
> > > >>  gcc/multiple_target.c                   | 32 ++++++++-----------------
> > > >>  gcc/testsuite/g++.target/i386/pr88587.C | 15 ++++++++++++
> > > >>  gcc/testsuite/gcc.target/i386/mvc13.c   |  9 +++++++
> > > >>  gcc/tree-inline.c                       |  4 ++++
> > > >>  6 files changed, 61 insertions(+), 24 deletions(-)
> > > >>  create mode 100644 gcc/testsuite/g++.target/i386/pr88587.C
> > > >>  create mode 100644 gcc/testsuite/gcc.target/i386/mvc13.c
> > > >>
> > > >>
> > >
>
> It is wrong to use -m32 in dg-options:
>
> /* { dg-do compile } */
> /* { dg-require-ifunc "" } */
> /* { dg-options "-O -m32 -g -mno-sse" } */
>
> You should use
>
> /* { dg-do compile { target ia32 } } */
>
> Since g++.target/i386/pr88587.C doesn't support -fPIC,
>
> [hjl@gnu-cfl-1 gcc]$ ./xgcc -B./
> /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C
> -mx32 -fpic -S
> /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C:6:6:
> warning: always_inline function might not be inlinable [-Wattributes]
>     6 | void a()
>       |      ^
> /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C:
> In function \u2018void a2()\u2019:
> /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C:6:6:
> error: inlining failed in call to always_inline \u2018void a()\u2019:
> function body can be overwritten at link time
> /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C:13:5:
> note: called from here
>    13 |   a ();
>       |   ~~^~
> [hjl@gnu-cfl-1 gcc]$
>
> you should add -fno-pic.
>

I am checking in this patch as an obvious fix.

-- 
H.J.
---
diff --git a/gcc/testsuite/g++.target/i386/pr88587.C
b/gcc/testsuite/g++.target/i386/pr88587.C
index 6808ab68cbb..e7488e68743 100644
--- a/gcc/testsuite/g++.target/i386/pr88587.C
+++ b/gcc/testsuite/g++.target/i386/pr88587.C
@@ -1,6 +1,6 @@
-/* { dg-do compile } */
+/* { dg-do compile { target ia32 } } */
 /* { dg-require-ifunc "" }  */
-/* { dg-options "-O -m32 -g -mno-sse -Wno-attributes" } */
+/* { dg-options "-O -fno-pic -g -mno-sse -Wno-attributes" } */

 __attribute__((target("default"),always_inline))
 void a()
diff --git a/gcc/testsuite/gcc.target/i386/mvc13.c
b/gcc/testsuite/gcc.target/i386/mvc13.c
index 9e31ef7c4da..8d7e34437b4 100644
--- a/gcc/testsuite/gcc.target/i386/mvc13.c
+++ b/gcc/testsuite/gcc.target/i386/mvc13.c
@@ -1,6 +1,6 @@
-/* { dg-do compile } */
+/* { dg-do compile { target ia32 } } */
 /* { dg-require-ifunc "" } */
-/* { dg-options "-O -m32 -g -mno-sse" } */
+/* { dg-options "-O -g -mno-sse" } */

 __attribute__((target_clones("default,sse2")))
 void a()

  reply	other threads:[~2019-01-18 14:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16  9:20 Martin Liška
2019-01-16  9:26 ` Martin Liška
2019-01-16 11:50   ` Richard Biener
2019-01-16 11:59     ` Jakub Jelinek
2019-01-16 12:01       ` Richard Biener
2019-01-16 12:06 ` Richard Biener
2019-01-17 11:21   ` Martin Liška
2019-01-17 12:51     ` Richard Biener
2019-01-18 14:25       ` H.J. Lu
2019-01-18 14:30         ` H.J. Lu [this message]
2019-04-15  6:50       ` Martin Liška
2019-04-15  7:50         ` Richard Biener
2019-04-15  8:11           ` Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMe9rOo-yq8NsROXyyWq78VD-8gVVq98w2bLGev5A9GHqDZB5A@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).