This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Support multi-versioning on self-recursive function (ipa/92133)
- From: Feng Xue OS <fxue at os dot amperecomputing dot com>
- To: luoxhu <luoxhu at linux dot ibm dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>, Martin Jambor <mjambor at suse dot cz>
- Date: Fri, 18 Oct 2019 03:50:01 +0000
- Subject: Re: [PATCH] Support multi-versioning on self-recursive function (ipa/92133)
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GFlLoB5dER5gut2UKsueYcj/Lc8nMJG1OPY2Ae4c1wU=; b=C+dHwfSv3MQxTMjJTlD7AoS2ROzW+sOEBaPEQgHW9qCfaLgjAdNSkqoarBHcQJJyE9X/YbkW5rghlLrEPUg9fFCxOmKVALcP+HTvWBLIlPdnSttakytyKtUKs5a3bVOZlN/Ptr3R9zcc/GpGi757weC1Nk8NvC2pLXOF9e28ACQqxB4pvYq9lAAcDcAUV7O2i2xaZ2K+zeq+XPl+wRdhByevczKoLv1AU0IPxCdxXpn/nkOp9bb67APCZsixVDqINlveddTTrwniraseBsLY3kOAf8TQ+4ej+lLkqNfLgNQzgjda2A1b3tMN3su8C9kWcrfYXyQpxwtnQ7MfE0GZeQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BIQsQSJ8OJtcjToTjHkshwKznShTfn48zi4bUWjnygrEYNmlyM5QcM+A0VQA7KcSGAbn8uJ2X08J1N2I3hCOvWjgOmkyUPC2iM7dvByGAETTlyg/b9RHZeKFm+X/MEC2BHu2PErWdVBhQcpW7CdoERKAtOToRfYqAWIfbnPZhnzdmw8E8XPAQKuw1JOeKf9FjtUXxylG+ZUvrQKOGqPB9xf2TmjuxgTv3H0arwU86//ohSDk7SWj5d/0j01HXBNKXSFa/xHmUcuOHiruG93HWHXNFFpVPUnE2UKTQypor5fF08MP1f1OXfbVlWdlSS2gX7R+x1p/ZK+nc9rjp/VDXA==
- References: <BYAPR01MB4869F706EB198F95EACD7692F76D0@BYAPR01MB4869.prod.exchangelabs.com>,<ca6dc810-560e-47aa-5f99-54289ce74369@linux.ibm.com>
> I noticed similar issue when analyzing the SPEC, self-recursive function is
> not versioned and posted my observations in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92074.
> Generally, this could be implemented well by your patch, while I am
> wondering whether it is OK to convert the recursive function to
> non-recursive function in a independent pass after ipa-cp and ipa-sra instead
> of reuse the ipa-cp framework?
> The reason is sometimes the argument is passed-by-reference, and
> ipa-sra runs after ipa-cp, so this kind of optimization may not be done in
> WPA. What's your idea about this, please? Thanks.
Function versioning is done in ipa-cp, there is nothing special for recursive function.
So adding a dedicated pass for recursive seems to be redundant.
We might not need to resort to ipa-sra to resolve concern you mentioned. Original
ipa-cp already supports a simple kind of propagation on by-ref argument, who must
be defined by constant. And for an extended form as: *arg = *param OP constant, I've
created a tracker PR91682, also composed a patch:
https://gcc.gnu.org/ml/gcc-patches/2019-09/msg01189.html.
Feng