[PATCH] arm/aarch64: Add bti for all functions [PR106671]

2023-08-02 Thread Feng Xue OS via Gcc-patches
This patch extends option -mbranch-protection=bti with an optional argument as bti[+all] to force compiler to unconditionally insert bti for all functions. Because a direct function call at the stage of compiling might be rewritten to an indirect call with some kind of linker-generated thunk stub

PING^2: [PATCH/RFC 2/2] WPD: Enable whole program devirtualization at LTRANS

2021-10-14 Thread Feng Xue OS via Gcc-patches
Thanks, Feng From: Feng Xue OS Sent: Thursday, September 16, 2021 5:26 PM To: Jan Hubicka; mjam...@suse.cz; Richard Biener; gcc-patches@gcc.gnu.org Cc: JiangNing OS Subject: [PATCH/RFC 2/2] WPD: Enable whole program devirtualization at LTRANS This patch

PING^2: [PATCH/RFC 1/2] WPD: Enable whole program devirtualization

2021-10-14 Thread Feng Xue OS via Gcc-patches
able whole program devirtualization >On 9/16/21 22:29, Feng Xue OS wrote: >>> On 9/16/21 05:25, Feng Xue OS via Gcc-patches wrote: >>>> This and following patches are composed to enable full devirtualization >>>> under whole program assumption (so also called

PING: [PATCH/RFC 2/2] WPD: Enable whole program devirtualization at LTRANS

2021-09-29 Thread Feng Xue OS via Gcc-patches
Made some minor changes. Thanks, Feng From: Feng Xue OS Sent: Thursday, September 16, 2021 5:26 PM To: Jan Hubicka; mjam...@suse.cz; Richard Biener; gcc-patches@gcc.gnu.org Cc: JiangNing OS Subject: [PATCH/RFC 2/2] WPD: Enable whole program

PING: [PATCH/RFC 1/2] WPD: Enable whole program devirtualization

2021-09-29 Thread Feng Xue OS via Gcc-patches
: Enable whole program devirtualization >On 9/16/21 22:29, Feng Xue OS wrote: >>> On 9/16/21 05:25, Feng Xue OS via Gcc-patches wrote: >>>> This and following patches are composed to enable full devirtualization >>>> under whole program assumption (so also called

[PATCH] Fix value uninitialization in vn_reference_insert_pieces [PR102400]

2021-09-22 Thread Feng Xue OS via Gcc-patches
Bootstrapped/regtested on x86_64-linux. Thanks, Feng --- 2021-09-23 Feng Xue gcc/ChangeLog PR tree-optimization/102400 * tree-ssa-sccvn.c (vn_reference_insert_pieces): Initialize result_vdef to zero value. --- gcc/tree-ssa-sccvn.c | 1 + 1 file changed, 1 insertion(+)

[PATCH] Fix null-pointer dereference in delete_dead_or_redundant_call [PR102451]

2021-09-22 Thread Feng Xue OS via Gcc-patches
Bootstrapped/regtested on x86_64-linux and aarch64-linux. Thanks, Feng --- 2021-09-23 Feng Xue gcc/ChangeLog: PR tree-optimization/102451 * tree-ssa-dse.c (delete_dead_or_redundant_call): Record bb of stmt before removal. --- gcc/tree-ssa-dse.c | 5 +++-- 1 file

Re: [PATCH/RFC 1/2] WPD: Enable whole program devirtualization

2021-09-18 Thread Feng Xue OS via Gcc-patches
>On 9/16/21 22:29, Feng Xue OS wrote: >>> On 9/16/21 05:25, Feng Xue OS via Gcc-patches wrote: >>>> This and following patches are composed to enable full devirtualization >>>> under whole program assumption (so also called whole-program >>

Re: [PATCH/RFC 1/2] WPD: Enable whole program devirtualization

2021-09-16 Thread Feng Xue OS via Gcc-patches
>On 9/16/21 05:25, Feng Xue OS via Gcc-patches wrote: >> This and following patches are composed to enable full devirtualization >> under whole program assumption (so also called whole-program >> devirtualization, WPD for short), which is an enhancement to current >> s

[PATCH/RFC 2/2] WPD: Enable whole program devirtualization at LTRANS

2021-09-16 Thread Feng Xue OS via Gcc-patches
This patch is to extend applicability of full devirtualization to LTRANS stage. Normally, whole program assumption would not hold when WPA splits whole compilation into more than one LTRANS partitions. To avoid information lost for WPD at LTRANS, we will record all vtable nodes and related member

[PATCH/RFC 1/2] WPD: Enable whole program devirtualization

2021-09-16 Thread Feng Xue OS via Gcc-patches
This and following patches are composed to enable full devirtualization under whole program assumption (so also called whole-program devirtualization, WPD for short), which is an enhancement to current speculative devirtualization. The base of the optimization is how to identify class type that is

Re: [PATCH] Fix loop split incorrect count and probability

2021-08-10 Thread Feng Xue OS via Gcc-patches
Any transformation involving cfg alteration would face same problem, it is not that easy to update new cfg with reasonable and seemly-correct profile count. We can adjust probability for impacted condition bbs, but lack of a utility like what static profile estimating pass does, and only

Re: [PATCH] Fix loop split incorrect count and probability

2021-08-08 Thread Feng Xue OS via Gcc-patches
Yes. Condition to to switch two versioned loops is "true", the first two arguments should be 100% and 0%. It is different from normal loop split, we could not deduce exactly precise probability for condition-based loop split, since cfg inside loop2 would be changed. (invar-branch is replaced

Question about non-POD class type

2021-05-14 Thread Feng Xue OS via Gcc-patches
For an instance of a non-POD class, can I always assume that any operation on it should be type-safe, any wrong or even trick code to violate this is UB in C++ spec? For example, here are some ways: union { Type1 *p1; Type2 *p2; }; or union { Type1 t1; Type2 t2; }; or void

Re: [PATCH/RFC] Add a new memory gathering optimization for loop (PR98598)

2021-05-06 Thread Feng Xue OS via Gcc-patches
>> gcc/ >> PR tree-optimization/98598 >> * Makefile.in (OBJS): Add tree-ssa-loop-mgo.o. >> * common.opt (-ftree-loop-mgo): New option. > > Just a quick comment - -ftree-loop-mgo is user-facing and it isn't really a > good > name. -floop-mgo would be better but still I'd

Re: [PATCH/RFC] Add a new memory gathering optimization for loop (PR98598)

2021-04-29 Thread Feng Xue OS via Gcc-patches
>> This patch implements a new loop optimization according to the proposal >> in RFC given at >> https://gcc.gnu.org/pipermail/gcc/2021-January/234682.html. >> So do not repeat the idea in this mail. Hope your comments on it. > > With the caveat that I'm not an optimization expert (but no one

[PATCH] Fix testcases to avoid plusminus-with-convert pattern (PR 97066)

2020-09-16 Thread Feng Xue OS via Gcc-patches
With the new pattern rule (T)(A) +- (T)(B) -> (T)(A +- B), some testcases are simplified and could not keep expected code pattern as test-check. Minor changes are made to those cases to avoid simplification effect of the rule. Tested on x86_64-linux and aarch64-linux. Feng --- 2020-09-16 Feng

Re: [PATCH 2/2 V4] Add plusminus-with-convert pattern (PR 94234)

2020-09-15 Thread Feng Xue OS via Gcc-patches
>> Add a rule (T)(A) +- (T)(B) -> (T)(A +- B), which works only when (A +- B) >> could be folded to a simple value. By this rule, a >> plusminus-mult-with-convert >> expression could be handed over to the rule (A * C) +- (B * C) -> (A +- B). > >Please use INTEGRAL_TYPE_P () instead of TREE_CODE

Re: Ping: [PATCH 2/2 V3] Simplify plusminus-mult-with-convert expr in forwprop (PR 94234)

2020-09-15 Thread Feng Xue OS via Gcc-patches
>> This patch is to handle simplification of plusminus-mult-with-convert >> expression >> as ((T) X) +- ((T) Y), in which at least one of (X, Y) is result of >> multiplication. >> This is done in forwprop pass. We try to transform it to (T) (X +- Y), and >> resort >> to gimple-matcher to fold

[PATCH 2/2 V4] Add plusminus-with-convert pattern (PR 94234)

2020-09-15 Thread Feng Xue OS via Gcc-patches
Add a rule (T)(A) +- (T)(B) -> (T)(A +- B), which works only when (A +- B) could be folded to a simple value. By this rule, a plusminus-mult-with-convert expression could be handed over to the rule (A * C) +- (B * C) -> (A +- B). Bootstrapped/regtested on x86_64-linux and aarch64-linux. Feng ---

Re: Ping: [PATCH 1/2] Fold plusminus_mult expr with multi-use operands (PR 94234)

2020-09-14 Thread Feng Xue OS via Gcc-patches
From: Richard Biener Sent: Monday, September 14, 2020 9:39 PM To: Feng Xue OS Cc: gcc-patches@gcc.gnu.org Subject: Re: Ping: [PATCH 1/2] Fold plusminus_mult expr with multi-use operands (PR 94234) On Mon, Sep 14, 2020 at 5:17 AM Feng Xue OS via Gcc-pa

Ping: [PATCH 1/2] Fold plusminus_mult expr with multi-use operands (PR 94234)

2020-09-13 Thread Feng Xue OS via Gcc-patches
Thanks, Feng From: Feng Xue OS Sent: Thursday, September 3, 2020 2:06 PM To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/2] Fold plusminus_mult expr with multi-use operands (PR 94234) For pattern A * C +- B * C -> (A +- B) * C, simplification is disabled

Ping: [PATCH 2/2 V3] Simplify plusminus-mult-with-convert expr in forwprop (PR 94234)

2020-09-13 Thread Feng Xue OS via Gcc-patches
From: Gcc-patches on behalf of Feng Xue OS via Gcc-patches Sent: Thursday, September 3, 2020 5:27 PM To: Richard Biener; gcc-patches@gcc.gnu.org Subject: [PATCH 2/2 V3] Simplify plusminus-mult-with-convert expr in forwprop (PR 94234) This patch is to handle simplification

Re: [PATCH] Fix ICE in ipa-cp due to cost addition overflow (PR 96806)

2020-09-04 Thread Feng Xue OS via Gcc-patches
>> Hi, >> >> On Mon, Aug 31 2020, Feng Xue OS wrote: >> > This patch is to fix a bug that cost that is used to evaluate clone >> > candidate >> > becomes negative due to integer overflow. >> > >> > Feng >> > --- >> > 2020-08-31 Feng Xue >> > >> > gcc/ >> > PR tree-optimization/96806 >>

Re: [PATCH 2/2 V3] Simplify plusminus-mult-with-convert expr in forwprop (PR 94234)

2020-09-03 Thread Feng Xue OS via Gcc-patches
Attach patch file. Feng From: Gcc-patches on behalf of Feng Xue OS via Gcc-patches Sent: Thursday, September 3, 2020 5:27 PM To: Richard Biener; gcc-patches@gcc.gnu.org Subject: [PATCH 2/2 V3] Simplify plusminus-mult-with-convert expr in forwprop (PR

[PATCH 2/2 V3] Simplify plusminus-mult-with-convert expr in forwprop (PR 94234)

2020-09-03 Thread Feng Xue OS via Gcc-patches
This patch is to handle simplification of plusminus-mult-with-convert expression as ((T) X) +- ((T) Y), in which at least one of (X, Y) is result of multiplication. This is done in forwprop pass. We try to transform it to (T) (X +- Y), and resort to gimple-matcher to fold (X +- Y) instead of

[PATCH 1/2] Fold plusminus_mult expr with multi-use operands (PR 94234)

2020-09-03 Thread Feng Xue OS via Gcc-patches
For pattern A * C +- B * C -> (A +- B) * C, simplification is disabled when A and B are not single-use. This patch is a minor enhancement on the pattern, which allows folding if final result is found to be a simple gimple value (constant/existing SSA). Bootstrapped/regtested on x86_64-linux and

Re: [PATCH V2] Add pattern for pointer-diff on addresses with same base/offset (PR 94234)

2020-09-01 Thread Feng Xue OS via Gcc-patches
>> >> gcc/ >> >> PR tree-optimization/94234 >> >> * tree-ssa-forwprop.c (simplify_binary_with_convert): New >> >> function. >> >> * (fwprop_ssa_val): Move it before its new caller. >> >> > No * at this line. There's an entry for (pass_forwprop::execute) missing. >> OK. >>

Re: [PATCH V2] Add pattern for pointer-diff on addresses with same base/offset (PR 94234)

2020-09-01 Thread Feng Xue OS via Gcc-patches
>> gcc/ >> PR tree-optimization/94234 >> * tree-ssa-forwprop.c (simplify_binary_with_convert): New function. >> * (fwprop_ssa_val): Move it before its new caller. > No * at this line. There's an entry for (pass_forwprop::execute) missing. OK. > I don't think the

PING: [PATCH V2] Add pattern for pointer-diff on addresses with same base/offset (PR 94234)

2020-08-31 Thread Feng Xue OS via Gcc-patches
Thanks, Feng From: Feng Xue OS Sent: Wednesday, August 19, 2020 5:17 PM To: Richard Biener Cc: gcc-patches@gcc.gnu.org; Marc Glisse Subject: [PATCH V2] Add pattern for pointer-diff on addresses with same base/offset (PR 94234) As Richard's comment, this

Re: [PATCH] Fix ICE in ipa-cp due to cost addition overflow (PR 96806)

2020-08-31 Thread Feng Xue OS via Gcc-patches
>>> the component is "ipa," please change that when you commit the patch. >> Mistake has been made, I'v pushed it. Is there a way to correct it? git push >> --force? > > There is. You need to wait until tomorrow (after the commit message > gets copied to gcc/ChangeLog by a script) and then push

Re: [PATCH] Fix ICE in ipa-cp due to cost addition overflow (PR 96806)

2020-08-31 Thread Feng Xue OS via Gcc-patches
>> gcc/ >> PR tree-optimization/96806 > the component is "ipa," please change that when you commit the patch. Mistake has been made, I'v pushed it. Is there a way to correct it? git push --force? Thanks, Feng

[PATCH] Fix ICE in ipa-cp due to cost addition overflow (PR 96806)

2020-08-31 Thread Feng Xue OS via Gcc-patches
This patch is to fix a bug that cost that is used to evaluate clone candidate becomes negative due to integer overflow. Feng --- 2020-08-31 Feng Xue gcc/ PR tree-optimization/96806 * ipa-cp.c (decide_about_value): Use safe_add to avoid cost addition overflow.

[PATCH V2] Add pattern for pointer-diff on addresses with same base/offset (PR 94234)

2020-08-19 Thread Feng Xue OS via Gcc-patches
As Richard's comment, this patch is composed to simplify generalized binary-with-convert pattern like ((T) X) OP ((T) Y). Instead of creating almost duplicated rules into match.pd, we try to transform it to (T) (X OP Y), and apply simplification on (X OP Y) in forwprop pass. Regards, Feng ---

Re: [PATCH] ipa-inline: Improve growth accumulation for recursive calls

2020-08-12 Thread Feng Xue OS via Gcc-patches
> Hello, > with Martin we spent some time looking into exchange2 and my > understanding of the problem is the following: > > There is the self recursive function digits_2 with the property that it > has 10 nested loops and calls itself from the innermost. > Now we do not do amazing job on

Re: [PATCH] Add pattern for pointer-diff on addresses with same base/offset (PR 94234)

2020-06-16 Thread Feng Xue OS via Gcc-patches
nks, Feng From: Marc Glisse Sent: Wednesday, June 3, 2020 10:32 PM To: Feng Xue OS Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Add pattern for pointer-diff on addresses with same base/offset (PR 94234) On Wed, 3 Jun 2020, Feng Xue OS via Gcc-patches wrote: >> Ah, looking at the

Ping: [PATCH V2] Add pattern for pointer-diff on addresses with same base/offset (PR 94234)

2020-06-14 Thread Feng Xue OS via Gcc-patches
:30 PM To: gcc-patches@gcc.gnu.org Cc: Feng Xue OS Subject: Re: [PATCH] Add pattern for pointer-diff on addresses with same base/offset (PR 94234) On Wed, Jun 3, 2020 at 4:33 PM Marc Glisse wrote: > > On Wed, 3 Jun 2020, Feng Xue OS via Gcc-patches wrote: > > >> Ah, looking at

Re: [PATCH] Add pattern for pointer-diff on addresses with same base/offset (PR 94234)

2020-06-05 Thread Feng Xue OS via Gcc-patches
ener Sent: Thursday, June 4, 2020 4:30 PM To: gcc-patches@gcc.gnu.org Cc: Feng Xue OS Subject: Re: [PATCH] Add pattern for pointer-diff on addresses with same base/offset (PR 94234) On Wed, Jun 3, 2020 at 4:33 PM Marc Glisse wrote: > > On Wed, 3 Jun 2020, Feng Xue OS via Gcc-patches wrote:

Re: [PATCH] Add pattern for pointer-diff on addresses with same base/offset (PR 94234)

2020-06-03 Thread Feng Xue OS via Gcc-patches
>> * match.pd ((PTR + A) - (PTR + B)) -> (ptrdiff_t)(A - B): New >> simplification. > Not new, modified. OK. >> * ((PTR_A + O) - (PTR_B + O)) -> (PTR_A - PTR_B): New simplification. > O might not be the best choice because of how close it looks to 0. OK. > What don't you like

Re: [PATCH] Add pattern for pointer-diff on addresses with same base/offset (PR 94234)

2020-06-03 Thread Feng Xue OS via Gcc-patches
>> This patch is meant to add match rules to simplify patterns as: >> >> o. (pointer + offset_a) - (pointer + offset_b) -> (ptrdiff_t) (offset_a >> - offset_b) >> o. (pointer_a + offset) - (pointer_b + offset) -> (pointer_a - pointer_b) > You are also changing the existing pattern which

[PATCH] Fix some improper debug dump in clone materialization

2020-06-01 Thread Feng Xue OS via Gcc-patches
Clone materialization might produce some improper debug output as: Original-- cloning foo/271 to foo.constprop/334 replace map: 0 -> xxx1->yyy m_always_copy_start: 1 IPA adjusted parameters: foo (...) { ... } And a better output could be: cloning foo/271 to foo.constprop/334

[PATCH] Add pattern for pointer-diff on addresses with same base/offset (PR 94234)

2020-06-01 Thread Feng Xue OS via Gcc-patches
This patch is meant to add match rules to simplify patterns as: o. (pointer + offset_a) - (pointer + offset_b) -> (ptrdiff_t) (offset_a - offset_b) o. (pointer_a + offset) - (pointer_b + offset) -> (pointer_a - pointer_b) Bootstrapped/regtested on x86_64-linux and aarch64-linux. Feng