From: Qing Zhao <qing.zhao@oracle.com>
To: Richard Biener <rguenther@suse.de>
Cc: Richard Sandiford <richard.sandiford@arm.com>,
Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org>
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 [thread overview]
Message-ID: <8CF30FEB-F179-43AE-8BC8-EC96063F9768@oracle.com> (raw)
In-Reply-To: <1CDF271D-8C6C-4350-84D1-272537E4BFC1@ORACLE.COM>
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;
}
+static void
+find_func_aliases_for_deferred_init (gcall *t)
+{
+
+ tree lhsop = gimple_call_lhs (t);
+ enum auto_init_type init_type
+ = (enum auto_init_type) TREE_INT_CST_LOW (gimple_call_arg (t, 1));
+ auto_vec<ce_s, 2> lhsc;
+ auto_vec<ce_s, 4> rhsc;
+ struct constraint_expr temp;
+
+ get_constraint_for (lhsop, &lhsc);
+ if (init_type == AUTO_INIT_ZERO && flag_delete_null_pointer_checks)
+ temp.var = nothing_id;
+ else
+ temp.var = nonlocal_id;
+ temp.type = ADDRESSOF;
+ temp.offset = 0;
+ rhsc.safe_push (temp);
+
+ process_all_all_constraints (lhsc, rhsc);
+ return;
+}
+
/* Create constraints for the call T. */
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;
+ if (gimple_call_internal_p (t, IFN_DEFERRED_INIT))
+ {
+ find_func_aliases_for_deferred_init (t);
+ return;
+ }
+
The *.ealias dump for the routine “bump_map” are exactly the same for approach A and D.
However, the stack size for D still bigger than A.
Any suggestions?
Qing
On Feb 2, 2021, at 9:17 AM, Qing Zhao via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>
>
>
>> On Feb 2, 2021, at 1:43 AM, Richard Biener <rguenther@suse.de> wrote:
>>
>> On Mon, 1 Feb 2021, Qing Zhao wrote:
>>
>>> Hi, Richard,
>>>
>>> I have adjusted SRA phase to split calls to DEFERRED_INIT per you suggestion.
>>>
>>> And now the routine “bump_map” in 511.povray is like following:
>>> ...
>>>
>>> # DEBUG BEGIN_STMT
>>> xcoor = 0.0;
>>> ycoor = 0.0;
>>> # DEBUG BEGIN_STMT
>>> index = .DEFERRED_INIT (index, 2);
>>> index2 = .DEFERRED_INIT (index2, 2);
>>> index3 = .DEFERRED_INIT (index3, 2);
>>> # DEBUG BEGIN_STMT
>>> colour1 = .DEFERRED_INIT (colour1, 2);
>>> colour2 = .DEFERRED_INIT (colour2, 2);
>>> colour3 = .DEFERRED_INIT (colour3, 2);
>>> # DEBUG BEGIN_STMT
>>> p1$0_181 = .DEFERRED_INIT (p1$0_195(D), 2);
>>> # DEBUG p1$0 => p1$0_181
>>> p1$1_184 = .DEFERRED_INIT (p1$1_182(D), 2);
>>> # DEBUG p1$1 => p1$1_184
>>> p1$2_172 = .DEFERRED_INIT (p1$2_185(D), 2);
>>> # DEBUG p1$2 => p1$2_172
>>> p2$0_177 = .DEFERRED_INIT (p2$0_173(D), 2);
>>> # DEBUG p2$0 => p2$0_177
>>> p2$1_135 = .DEFERRED_INIT (p2$1_178(D), 2);
>>> # DEBUG p2$1 => p2$1_135
>>> p2$2_137 = .DEFERRED_INIT (p2$2_136(D), 2);
>>> # DEBUG p2$2 => p2$2_137
>>> p3$0_377 = .DEFERRED_INIT (p3$0_376(D), 2);
>>> # DEBUG p3$0 => p3$0_377
>>> p3$1_379 = .DEFERRED_INIT (p3$1_378(D), 2);
>>> # DEBUG p3$1 => p3$1_379
>>> p3$2_381 = .DEFERRED_INIT (p3$2_380(D), 2);
>>> # DEBUG p3$2 => p3$2_381
>>>
>>>
>>> In the above, p1, p2, and p3 are all splitted to calls to DEFERRED_INIT of the components of p1, p2 and p3.
>>>
>>> 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:
>>>
>>> Approach A Approach D-old Approach D-new
>>>
>>> 272 624 368
>>>
>>> From the above, we can see that splitting the call to DEFERRED_INIT in SRA can reduce the stack usage increase dramatically.
>>>
>>> However, looks like that the stack size for D is still bigger than A.
>>>
>>> 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):
>>>
>>> (Due to the call to:
>>>
>>> colour1 = .DEFERRED_INIT (colour1, 2);
>>> )
>>>
>>> ******Approach A:
>>>
>>> Points_to analysis:
>>>
>>> Constraints:
>>> …
>>> colour1 = &NULL
>>> …
>>> colour1 = &NONLOCAL
>>> colour1 = &NONLOCAL
>>> colour1 = &NONLOCAL
>>> colour1 = &NONLOCAL
>>> colour1 = &NONLOCAL
>>> ...
>>> callarg(53) = &colour1
>>> ...
>>> _53 = colour1
>>>
>>> Points_to sets:
>>> …
>>> colour1 = { NULL ESCAPED NONLOCAL } same as _53
>>> ...
>>> CALLUSED(48) = { NULL ESCAPED NONLOCAL index colour1 }
>>> CALLCLOBBERED(49) = { NULL ESCAPED NONLOCAL index colour1 } same as CALLUSED(48)
>>> ...
>>> callarg(53) = { NULL ESCAPED NONLOCAL colour1 }
>>>
>>> ******Apprach D:
>>>
>>> Points_to analysis:
>>>
>>> Constraints:
>>> …
>>> callarg(19) = colour1
>>> callarg(19) = &NONLOCAL
>>> colour1 = callarg(19) + UNKNOWN
>>> colour1 = &NONLOCAL
>>> …
>>> colour1 = &NONLOCAL
>>> colour1 = &NONLOCAL
>>> colour1 = &NONLOCAL
>>> colour1 = &NONLOCAL
>>> colour1 = &NONLOCAL
>>> …
>>> callarg(74) = &colour1
>>> callarg(74) = callarg(74) + UNKNOWN
>>> callarg(74) = *callarg(74) + UNKNOWN
>>> …
>>> _53 = colour1
>>> _54 = _53
>>> _55 = _54 + UNKNOWN
>>> _55 = &NONLOCAL
>>> _56 = colour1
>>> _57 = _56
>>> _58 = _57 + UNKNOWN
>>> _58 = &NONLOCAL
>>> _59 = _55 + UNKNOWN
>>> _59 = _58 + UNKNOWN
>>> _60 = colour1
>>> _61 = _60
>>> _62 = _61 + UNKNOWN
>>> _62 = &NONLOCAL
>>> _63 = _59 + UNKNOWN
>>> _63 = _62 + UNKNOWN
>>> _64 = _63 + UNKNOWN
>>> ..
>>> Points_to set:
>>> …
>>> colour1 = { ESCAPED NONLOCAL } same as callarg(19)
>>> …
>>> CALLUSED(69) = { ESCAPED NONLOCAL index colour1 }
>>> CALLCLOBBERED(70) = { ESCAPED NONLOCAL index colour1 } same as CALLUSED(69)
>>> callarg(71) = { ESCAPED NONLOCAL }
>>> callarg(72) = { ESCAPED NONLOCAL }
>>> callarg(73) = { ESCAPED NONLOCAL }
>>> callarg(74) = { ESCAPED NONLOCAL colour1 }
>>>
>>> My question:
>>>
>>> Is it possible to adjust alias analysis to resolve this issue?
>>
>> 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.
>
> Okay, thanks.
>
> Will check on that.
>
> Qing
>>>
>>
>> --
>> Richard Biener <rguenther@suse.de <mailto:rguenther@suse.de> <mailto:rguenther@suse.de <mailto:rguenther@suse.de>>>
>> SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
>> Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)
next prev parent reply other threads:[~2021-02-02 23:32 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-23 23:05 How to traverse all the local variables that declared in the current routine? Qing Zhao
2020-11-24 7:32 ` Richard Biener
2020-11-24 15:47 ` Qing Zhao
2020-11-24 15:55 ` Richard Biener
2020-11-24 16:54 ` Qing Zhao
2020-11-25 9:11 ` Richard Biener
2020-11-25 17:41 ` Qing Zhao
2020-12-01 19:47 ` Qing Zhao
2020-12-02 8:45 ` Richard Biener
2020-12-02 15:36 ` Qing Zhao
2020-12-03 8:45 ` Richard Biener
2020-12-03 16:07 ` Qing Zhao
2020-12-03 16:36 ` Richard Biener
2020-12-03 16:40 ` Qing Zhao
2020-12-03 16:56 ` Richard Sandiford
2020-11-26 0:08 ` Martin Sebor
2020-11-30 16:23 ` Qing Zhao
2020-11-30 17:18 ` Martin Sebor
2020-11-30 23:05 ` Qing Zhao
2020-12-03 17:32 ` Richard Sandiford
2020-12-03 23:04 ` Qing Zhao
2020-12-04 8:50 ` Richard Biener
2020-12-04 16:19 ` Qing Zhao
2020-12-07 7:12 ` Richard Biener
2020-12-07 16:20 ` Qing Zhao
2020-12-07 17:10 ` Richard Sandiford
2020-12-07 17:36 ` Qing Zhao
2020-12-07 18:05 ` Richard Sandiford
2020-12-07 18:34 ` Qing Zhao
2020-12-08 7:35 ` Richard Biener
2020-12-08 7:40 ` Richard Biener
2020-12-08 19:54 ` Qing Zhao
2020-12-09 8:23 ` Richard Biener
2020-12-09 15:04 ` Qing Zhao
2020-12-09 15:12 ` Richard Biener
2020-12-09 16:18 ` Qing Zhao
2021-01-05 19:05 ` The performance data for two different implementation of new security feature -ftrivial-auto-var-init Qing Zhao
2021-01-05 19:10 ` Qing Zhao
2021-01-12 20:34 ` Qing Zhao
2021-01-13 7:39 ` Richard Biener
2021-01-13 15:06 ` Qing Zhao
2021-01-13 15:10 ` Richard Biener
2021-01-13 15:35 ` Qing Zhao
2021-01-13 15:40 ` Richard Biener
2021-01-14 21:16 ` Qing Zhao
2021-01-15 8:11 ` Richard Biener
2021-01-15 16:16 ` Qing Zhao
2021-01-15 17:22 ` Richard Biener
2021-01-15 17:57 ` Qing Zhao
2021-01-18 13:09 ` Richard Sandiford
2021-01-18 16:12 ` Qing Zhao
2021-02-01 19:12 ` Qing Zhao
2021-02-02 7:43 ` Richard Biener
2021-02-02 15:17 ` Qing Zhao
2021-02-02 23:32 ` Qing Zhao [this message]
2020-12-07 17:21 ` How to traverse all the local variables that declared in the current routine? Richard Sandiford
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=8CF30FEB-F179-43AE-8BC8-EC96063F9768@oracle.com \
--to=qing.zhao@oracle.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
--cc=richard.sandiford@arm.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).