From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id CC13E385800A; Fri, 31 Mar 2023 12:46:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC13E385800A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680266805; bh=lGQZLlf8hmnXHdAxAcTUsEKhtnpbxa9gcj7pCpZiv+U=; h=From:To:Subject:Date:From; b=apPiyZoa26aoBVfqnYVKSRCm/axNzqw7cYU75FQLhv99Q35KjxPhdVvr8cA67N0oS 9fnBZFNE9yPM6lMpnYso5qcVM8fs2cdB7ICtxNB9MnzS49CJ2gaE8kB9iZD7NZM151 WFuEbcow6psewnSTEGtJw2pbAg4Anhgx3h5DRtGM= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/PR106816-mv-attributes)] ipa: propagate attributes for target attribute clones X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/PR106816-mv-attributes X-Git-Oldrev: 608388486a54afe98aed0f105a6101ae7a9ff66c X-Git-Newrev: 816b951f2ae3f81485597170f83ce15e70a27c35 Message-Id: <20230331124645.CC13E385800A@sourceware.org> Date: Fri, 31 Mar 2023 12:46:45 +0000 (GMT) List-Id: https://gcc.gnu.org/g:816b951f2ae3f81485597170f83ce15e70a27c35 commit 816b951f2ae3f81485597170f83ce15e70a27c35 Author: Martin Liska Date: Fri Mar 31 12:16:34 2023 +0200 ipa: propagate attributes for target attribute clones PR ipa/106816 gcc/ChangeLog: * config/i386/i386-features.cc (ix86_get_function_versions_dispatcher): Propagate function attributes for clones. gcc/testsuite/ChangeLog: * g++.target/i386/pr106816.C: New test. Co-Authored-By: H.J. Lu Diff: --- gcc/config/i386/i386-features.cc | 1 + gcc/testsuite/g++.target/i386/pr106816.C | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc index c09abf8fc20..f2b0d59a73c 100644 --- a/gcc/config/i386/i386-features.cc +++ b/gcc/config/i386/i386-features.cc @@ -3379,6 +3379,7 @@ ix86_get_function_versions_dispatcher (void *decl) /* Right now, the dispatching is done via ifunc. */ dispatch_decl = make_dispatcher_decl (default_node->decl); TREE_NOTHROW (dispatch_decl) = TREE_NOTHROW (fn); + TREE_THIS_VOLATILE (dispatch_decl) = TREE_THIS_VOLATILE (fn); dispatcher_node = cgraph_node::get_create (dispatch_decl); gcc_assert (dispatcher_node != NULL); diff --git a/gcc/testsuite/g++.target/i386/pr106816.C b/gcc/testsuite/g++.target/i386/pr106816.C new file mode 100644 index 00000000000..0f5cc1f13dd --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr106816.C @@ -0,0 +1,23 @@ +// PR ipa/106816 + +// { dg-do compile } +// { dg-require-ifunc "" } +// { dg-options "-O2 -fdump-tree-optimized" } + +__attribute__((noreturn, target("default"))) void f() +{ + for (;;) {} +} + +__attribute__((noreturn, target("sse4.2,bmi"))) void f() +{ + for (;;) {} +} + +int main() +{ + f(); + return 12345; +} + +/* { dg-final { scan-tree-dump-not "12345" "optimized" } } */