From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by sourceware.org (Postfix) with ESMTPS id 0E4233858006 for ; Tue, 2 Feb 2021 23:32:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0E4233858006 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 112NSugY141698; Tue, 2 Feb 2021 23:32:28 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36cydkwb4f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Feb 2021 23:32:28 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 112NUwWr174467; Tue, 2 Feb 2021 23:32:28 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 36dhc01f7c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Feb 2021 23:32:28 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 112NWQxd017422; Tue, 2 Feb 2021 23:32:27 GMT Received: from dhcp-10-154-108-139.vpn.oracle.com (/10.154.108.139) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 02 Feb 2021 15:32:26 -0800 From: Qing Zhao Message-Id: <8CF30FEB-F179-43AE-8BC8-EC96063F9768@oracle.com> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: The performance data for two different implementation of new security feature -ftrivial-auto-var-init Date: Tue, 2 Feb 2021 17:32:25 -0600 In-Reply-To: <1CDF271D-8C6C-4350-84D1-272537E4BFC1@ORACLE.COM> Cc: Richard Sandiford , Richard Biener via Gcc-patches To: Richard Biener References: <89D58812-0F3E-47AE-95A5-0A07B66EED8C@ORACLE.COM> <9585CBB2-0082-4B9A-AC75-250F54F0797C@ORACLE.COM> <51911859-45D5-4566-B588-F828B9D7313B@ORACLE.COM> <9127AAB9-92C8-4A1B-BAD5-2F5F8762DCF9@ORACLE.COM> <5A0F7219-DAFA-4EAA-B845-0E236A108738@ORACLE.COM> <7E70D6B0-CA52-4957-BF84-401AA6E094D7@ORACLE.COM> <4BD13E0F-A561-4429-AEB8-5BDEA6987D21@ORACLE.COM> <67ACD88A-ADF3-433F-901F-2F1F895B703A@ORACLE.COM> <1CDF271D-8C6C-4350-84D1-272537E4BFC1@ORACLE.COM> X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9883 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 suspectscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102020150 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9883 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102020150 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 23:32:35 -0000 Hi, With the following patch: [qinzhao@localhost gcc]$ git diff tree-ssa-structalias.c diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index cf653be..bd18841 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -4851,6 +4851,30 @@ find_func_aliases_for_builtin_call (struct = function *fn, gcall *t) return false; } =20 +static void +find_func_aliases_for_deferred_init (gcall *t) +{ + =20 + tree lhsop =3D gimple_call_lhs (t); + enum auto_init_type init_type + =3D (enum auto_init_type) TREE_INT_CST_LOW (gimple_call_arg (t, = 1)); + auto_vec lhsc; + auto_vec rhsc; + struct constraint_expr temp; +=20 + get_constraint_for (lhsop, &lhsc); + if (init_type =3D=3D AUTO_INIT_ZERO && = flag_delete_null_pointer_checks) + temp.var =3D nothing_id; + else + temp.var =3D nonlocal_id; + temp.type =3D ADDRESSOF; + temp.offset =3D 0; + rhsc.safe_push (temp); + + process_all_all_constraints (lhsc, rhsc); + return; +} + /* Create constraints for the call T. */ =20 static void @@ -4864,6 +4888,12 @@ find_func_aliases_for_call (struct function *fn, = gcall *t) && find_func_aliases_for_builtin_call (fn, t)) return; =20 + if (gimple_call_internal_p (t, IFN_DEFERRED_INIT)) + { + find_func_aliases_for_deferred_init (t); + return; + } + The *.ealias dump for the routine =E2=80=9Cbump_map=E2=80=9D are exactly = the same for approach A and D.=20 However, the stack size for D still bigger than A.=20 Any suggestions? Qing On Feb 2, 2021, at 9:17 AM, Qing Zhao via Gcc-patches = wrote: >=20 >=20 >=20 >> On Feb 2, 2021, at 1:43 AM, Richard Biener wrote: >>=20 >> On Mon, 1 Feb 2021, Qing Zhao wrote: >>=20 >>> Hi, Richard, >>>=20 >>> I have adjusted SRA phase to split calls to DEFERRED_INIT per you = suggestion. >>>=20 >>> And now the routine =E2=80=9Cbump_map=E2=80=9D in 511.povray is like = following: >>> ... >>>=20 >>> # DEBUG BEGIN_STMT >>> xcoor =3D 0.0; >>> ycoor =3D 0.0; >>> # DEBUG BEGIN_STMT >>> index =3D .DEFERRED_INIT (index, 2); >>> index2 =3D .DEFERRED_INIT (index2, 2); >>> index3 =3D .DEFERRED_INIT (index3, 2); >>> # DEBUG BEGIN_STMT >>> colour1 =3D .DEFERRED_INIT (colour1, 2); >>> colour2 =3D .DEFERRED_INIT (colour2, 2); >>> colour3 =3D .DEFERRED_INIT (colour3, 2); >>> # DEBUG BEGIN_STMT >>> p1$0_181 =3D .DEFERRED_INIT (p1$0_195(D), 2); >>> # DEBUG p1$0 =3D> p1$0_181 >>> p1$1_184 =3D .DEFERRED_INIT (p1$1_182(D), 2); >>> # DEBUG p1$1 =3D> p1$1_184 >>> p1$2_172 =3D .DEFERRED_INIT (p1$2_185(D), 2); >>> # DEBUG p1$2 =3D> p1$2_172 >>> p2$0_177 =3D .DEFERRED_INIT (p2$0_173(D), 2); >>> # DEBUG p2$0 =3D> p2$0_177 >>> p2$1_135 =3D .DEFERRED_INIT (p2$1_178(D), 2); >>> # DEBUG p2$1 =3D> p2$1_135 >>> p2$2_137 =3D .DEFERRED_INIT (p2$2_136(D), 2); >>> # DEBUG p2$2 =3D> p2$2_137 >>> p3$0_377 =3D .DEFERRED_INIT (p3$0_376(D), 2); >>> # DEBUG p3$0 =3D> p3$0_377 >>> p3$1_379 =3D .DEFERRED_INIT (p3$1_378(D), 2); >>> # DEBUG p3$1 =3D> p3$1_379 >>> p3$2_381 =3D .DEFERRED_INIT (p3$2_380(D), 2); >>> # DEBUG p3$2 =3D> p3$2_381 >>>=20 >>>=20 >>> In the above, p1, p2, and p3 are all splitted to calls to = DEFERRED_INIT of the components of p1, p2 and p3.=20 >>>=20 >>> With this change, the stack usage numbers with -fstack-usage for = approach A, old approach D and new D with the splitting in SRA are: >>>=20 >>> Approach A Approach D-old Approach D-new >>>=20 >>> 272 624 368 >>>=20 >>> =46rom the above, we can see that splitting the call to = DEFERRED_INIT in SRA can reduce the stack usage increase dramatically.=20= >>>=20 >>> However, looks like that the stack size for D is still bigger than = A.=20 >>>=20 >>> I checked the IR again, and found that the alias analysis might be = responsible for this (by compare the image.cpp.026t.ealias for both A = and D): >>>=20 >>> (Due to the call to: >>>=20 >>> colour1 =3D .DEFERRED_INIT (colour1, 2); >>> ) >>>=20 >>> ******Approach A: >>>=20 >>> Points_to analysis: >>>=20 >>> Constraints: >>> =E2=80=A6 >>> colour1 =3D &NULL >>> =E2=80=A6 >>> colour1 =3D &NONLOCAL >>> colour1 =3D &NONLOCAL >>> colour1 =3D &NONLOCAL >>> colour1 =3D &NONLOCAL >>> colour1 =3D &NONLOCAL >>> ... >>> callarg(53) =3D &colour1 >>> ... >>> _53 =3D colour1 >>>=20 >>> Points_to sets: >>> =E2=80=A6 >>> colour1 =3D { NULL ESCAPED NONLOCAL } same as _53 >>> ... >>> CALLUSED(48) =3D { NULL ESCAPED NONLOCAL index colour1 } >>> CALLCLOBBERED(49) =3D { NULL ESCAPED NONLOCAL index colour1 } same = as CALLUSED(48) >>> ... >>> callarg(53) =3D { NULL ESCAPED NONLOCAL colour1 } >>>=20 >>> ******Apprach D: >>>=20 >>> Points_to analysis: >>>=20 >>> Constraints: >>> =E2=80=A6 >>> callarg(19) =3D colour1 >>> callarg(19) =3D &NONLOCAL >>> colour1 =3D callarg(19) + UNKNOWN >>> colour1 =3D &NONLOCAL >>> =E2=80=A6 >>> colour1 =3D &NONLOCAL >>> colour1 =3D &NONLOCAL >>> colour1 =3D &NONLOCAL >>> colour1 =3D &NONLOCAL >>> colour1 =3D &NONLOCAL >>> =E2=80=A6 >>> callarg(74) =3D &colour1 >>> callarg(74) =3D callarg(74) + UNKNOWN >>> callarg(74) =3D *callarg(74) + UNKNOWN >>> =E2=80=A6 >>> _53 =3D colour1 >>> _54 =3D _53 >>> _55 =3D _54 + UNKNOWN >>> _55 =3D &NONLOCAL >>> _56 =3D colour1 >>> _57 =3D _56 >>> _58 =3D _57 + UNKNOWN >>> _58 =3D &NONLOCAL >>> _59 =3D _55 + UNKNOWN >>> _59 =3D _58 + UNKNOWN >>> _60 =3D colour1 >>> _61 =3D _60 >>> _62 =3D _61 + UNKNOWN >>> _62 =3D &NONLOCAL >>> _63 =3D _59 + UNKNOWN >>> _63 =3D _62 + UNKNOWN >>> _64 =3D _63 + UNKNOWN >>> .. >>> Points_to set: >>> =E2=80=A6 >>> colour1 =3D { ESCAPED NONLOCAL } same as callarg(19) >>> =E2=80=A6 >>> CALLUSED(69) =3D { ESCAPED NONLOCAL index colour1 } >>> CALLCLOBBERED(70) =3D { ESCAPED NONLOCAL index colour1 } same as = CALLUSED(69) >>> callarg(71) =3D { ESCAPED NONLOCAL } >>> callarg(72) =3D { ESCAPED NONLOCAL } >>> callarg(73) =3D { ESCAPED NONLOCAL } >>> callarg(74) =3D { ESCAPED NONLOCAL colour1 } >>>=20 >>> My question: >>>=20 >>> Is it possible to adjust alias analysis to resolve this issue? >>=20 >> You probably want to handle .DEFERRED_INIT in tree-ssa-structalias.c >> find_func_aliases_for_call (it's not a builtin but you can look in >> the respective subroutine for examples). Specifically you want to >> avoid making anything escaped or clobbered. >=20 > Okay, thanks. >=20 > Will check on that. >=20 > Qing >>>=20 >>=20 >> --=20 >> Richard Biener = >> >> SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 = Nuernberg, >> Germany; GF: Felix Imend=C3=B6rffer; HRB 36809 (AG Nuernberg)