From patchwork Fri Jun 24 20:41:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Stupachenko X-Patchwork-Id: 640418 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rbqxD6WQ0z9sXx for ; Sat, 25 Jun 2016 06:41:20 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=JykP7WTF; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=VDbMxL/WJ/KFn26wG6Xk8BByfgsvO0v4UAF+bUjJUpUn6E RvnAhvfAg0gtDPZRFs98lmtt4+VpaQG/7NKvqxpvM9PmhWcoFezWS9eaGYp3es/G TQlVrtM5/RIo9oBm/qkf9UrywJwaMSWXp+rEHYQi1HeKoOu9qb0nUEEzzl3R0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=xd2Xwq7hJmZzhdOitMUbzsIvDSo=; b=JykP7WTFjUnuwDjajCpW UFnlpXlVoK96XBtztIafcKI7LFDgDlkEscGSaHGZNlZ+zYYET70cP4QswMphYXqP cD/lhKNpjMjzk6Wiom3LbMPRN8HbXXWoGvo6OjkLD/B6YgmscPvV05CNnwUXpW6v pogSE24l3QHnNTKLOBGp5sc= Received: (qmail 96503 invoked by alias); 24 Jun 2016 20:41:13 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 96454 invoked by uid 89); 24 Jun 2016 20:41:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Ideally, Hx-spam-relays-external:209.85.214.66, H*RU:209.85.214.66 X-HELO: mail-it0-f66.google.com Received: from mail-it0-f66.google.com (HELO mail-it0-f66.google.com) (209.85.214.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 24 Jun 2016 20:41:08 +0000 Received: by mail-it0-f66.google.com with SMTP id g127so3731727ith.2 for ; Fri, 24 Jun 2016 13:41:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Y/eZRuJKIy41jDGoxZbsakCwGKwx1oVNd2BFKLvM0MY=; b=QszxvaBz2gfmV9c9T337NcfqKUvvX3dC5yff8wn/NB8KMEysVq2MG7PxKkeSfGgVuu 8IyHx/DJp68EGCWAZqpE2ymGQ/y5aVnRvArKRKRH86JQ/JjIoVJubbZJWxMltpvW/JDt RETwiFuaE5L+Fu5Cfdn54b2Cq1tl9ltIWVXElx3sbzb2+xr2ETBL9sLMGMH/CvIAj6nT dNdeu083YpUJmMvmoYirhwGGj12LIf3kBVbbDudeMGRW0kHzFNbuDjW52R04yVRUCTeR eU++2Z+Rl4ilE4hZoetszEX6Pwntcv8fwmNJs2mosLRIQjcz22fRXx9F8OxM8A7CNqBP k1Cg== X-Gm-Message-State: ALyK8tIV626dB8FpRx6qpEsuW17EXIVDSCN2NqBZ3opuNF1DHmLJ2PURMPsLzNARAIL4FiBxgq0TjDn7C5Jwag== X-Received: by 10.36.69.4 with SMTP id y4mr41563ita.49.1466800865326; Fri, 24 Jun 2016 13:41:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.144.66 with HTTP; Fri, 24 Jun 2016 13:41:05 -0700 (PDT) From: Evgeny Stupachenko Date: Fri, 24 Jun 2016 13:41:05 -0700 Message-ID: Subject: [PATCH] disable IPA-cp cloning for functions with target_clones attribute To: GCC Patches , Jan Hubicka , =?UTF-8?B?0JjQu9GM0Y8g0K3QvdC60L7QstC40Yc=?= , Jeff Law X-IsSubscribed: yes Hi, Fix ICE when IPA-cp and target_clones are applied to the same function. Is the patch ok for trunk? Thanks, Evgeny 2016-06-24 Evgeny Stupachenko gcc/ * ipa-cp.c (determine_versionability): Do not create constprop clones, when target_clones attribute is set. diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 2710494..4b642ba 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -533,6 +533,13 @@ determine_versionability (struct cgraph_node *node, coexist, but that may not be worth the effort. */ reason = "function has SIMD clones"; } + else if (lookup_attribute ("target_clones", DECL_ATTRIBUTES (node->decl))) + { + /* Ideally we should clone the target clones themselves and create + copies of them, so IPA-cp and target clones can happily + coexist, but that may not be worth the effort. */ + reason = "function target_clones attribute"; + } /* Don't clone decls local to a comdat group; it breaks and for C++ decloned constructors, inlining is always better anyway. */ else if (node->comdat_local_p ()) diff --git a/gcc/testsuite/gcc.target/i386/mvc8.c b/gcc/testsuite/gcc.target/i386/mvc8.c new file mode 100644 index 0000000..e9ab9e1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mvc8.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O3 -fno-inline" } */ +/* { dg-final { scan-assembler-not "constprop" } } */ +__attribute__((target_clones("arch=core-avx2","arch=slm","default"))) +void foo (float *a, int b) { + *a = (float)b; +} +float a; +int main() { + int i; + for (i = 0; i < 1024; i++) + foo (&a, 5); +}