[PATCH v5] gcov: Fix "do-while" structure in case statement leads to incorrect code coverage [PR93680]

2023-04-18 Thread Xionghu Luo via Gcc-patches
v5: Refine patch and send this for gcc14 stage1. v4: Address comments. 4.1. Handle GIMPLE_GOTO and GIMPLE_ASM. 4.2. Fix failure of limit-caselabels.c (labels on same line), pointer_array_1.f90 (unused labels) etc. v3: Add compute_target_labels and call it in the front of make_blocks_1. v2:

Re: [PATCH v4] rs6000: Fix incorrect RTL for Power LE when removing the UNSPECS [PR106069]

2023-03-30 Thread Xionghu Luo via Gcc-patches
Thanks, On 2023/3/31 03:30, Segher Boessenkool wrote: Hi! On Fri, Feb 10, 2023 at 10:59:52AM +0800, Xionghu Luo via Gcc-patches wrote: The native RTL expression for vec_mrghw should be same for BE and LE as they are register and endian-independent. This isn't so obvious at all. All

[RFC PATCH] ipa-visibility: Fix ICE in lto-partition caused by incorrect comdat group solving in ipa-visibility

2023-03-27 Thread Xionghu Luo via Gcc-patches
I have a case ICE in lto-partion.c:158 not easy to reduce, this ICE appears some time ago from link: https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586290.html. I tried the proposed patch but it doesn't work for me. Then I did some hack and finally got a successful lto link to compare

[PATCH v4] gcov: Fix "do-while" structure in case statement leads to incorrect code coverage [PR93680]

2023-03-15 Thread Xionghu Luo via Gcc-patches
On 2023/3/9 20:02, Richard Biener wrote: On Wed, 8 Mar 2023, Xionghu Luo wrote: On 2023/3/7 19:25, Richard Biener wrote: It would be nice to avoid creating blocks / preserving labels we'll immediately remove again. For that we do need some analysis before creating basic-blocks that

Re: [PATCH v4] gcov: Fix "do-while" structure in case statement leads to incorrect code coverage [PR93680]

2023-03-13 Thread Xionghu Luo via Gcc-patches
On 2023/3/9 20:02, Richard Biener wrote: On Wed, 8 Mar 2023, Xionghu Luo wrote: On 2023/3/7 19:25, Richard Biener wrote: It would be nice to avoid creating blocks / preserving labels we'll immediately remove again. For that we do need some analysis before creating basic-blocks that

[PATCH v3] gcov: Fix "do-while" structure in case statement leads to incorrect code coverage [PR93680]

2023-03-08 Thread Xionghu Luo via Gcc-patches
On 2023/3/7 19:25, Richard Biener wrote: It would be nice to avoid creating blocks / preserving labels we'll immediately remove again. For that we do need some analysis before creating basic-blocks that determines whether a label is possibly reached by a non-falltru edge. : p = 0; switch

Re: [PATCH 1/2] gcov: Fix "do-while" structure in case statement leads to incorrect code coverage [PR93680]

2023-03-07 Thread Xionghu Luo via Gcc-patches
On 2023/3/7 16:53, Richard Biener wrote: On Tue, 7 Mar 2023, Xionghu Luo wrote: Unfortunately this change (flag_test_coverage -> !optimize ) caused hundred of gfortran cases execution failure with O0. Take gfortran.dg/index.f90 for example: .gimple: __attribute__((fn spec (". "))) void

Re: [PATCH 1/2] gcov: Fix "do-while" structure in case statement leads to incorrect code coverage [PR93680]

2023-03-06 Thread Xionghu Luo via Gcc-patches
On 2023/3/6 16:11, Richard Biener wrote: On Mon, Mar 6, 2023 at 8:22 AM Xionghu Luo wrote: On 2023/3/2 18:45, Richard Biener wrote: small.gcno: 648: block 2:`small.c':1, 3, 4, 6 small.gcno: 688:0145: 36:LINES small.gcno: 700:

Re: [PATCH 1/2] gcov: Fix "do-while" structure in case statement leads to incorrect code coverage [PR93680]

2023-03-05 Thread Xionghu Luo via Gcc-patches
On 2023/3/2 18:45, Richard Biener wrote: small.gcno: 648: block 2:`small.c':1, 3, 4, 6 small.gcno: 688:0145: 36:LINES small.gcno: 700: block 3:`small.c':8, 9 small.gcno: 732:0145: 32:LINES small.gcno: 744:

Re: [PATCH 1/2] gcov: Fix "do-while" structure in case statement leads to incorrect code coverage [PR93680]

2023-03-02 Thread Xionghu Luo via Gcc-patches
On 2023/3/2 16:41, Richard Biener wrote: On Thu, Mar 2, 2023 at 3:31 AM Xionghu Luo via Gcc-patches wrote: When spliting edge with self loop, the split edge should be placed just next to the edge_in->src, otherwise it may generate different position latch bbs for two consecutive self lo

Re: [PATCH 2/2] gcov: Fix incorrect gimple line LOCATION [PR97923]

2023-03-02 Thread Xionghu Luo via Gcc-patches
On 2023/3/2 16:16, Richard Biener wrote: On Thu, Mar 2, 2023 at 3:31 AM Xionghu Luo via Gcc-patches wrote: For case like belowi test.c: 1:int foo(char c) 2:{ 3: return ((c >= 'A' && c <= 'Z') 4: || (c >= 'a' && c <= 'z') 5: || (c >= '0' &am

[PATCH 2/2] gcov: Fix incorrect gimple line LOCATION [PR97923]

2023-03-01 Thread Xionghu Luo via Gcc-patches
For case like belowi test.c: 1:int foo(char c) 2:{ 3: return ((c >= 'A' && c <= 'Z') 4: || (c >= 'a' && c <= 'z') 5: || (c >= '0' && c <='0'));} the generated line number is incorrect for condition c>='A' of block 2: Thus correct the condition op0 location. gcno diff before and

[PATCH 1/2] gcov: Fix "do-while" structure in case statement leads to incorrect code coverage [PR93680]

2023-03-01 Thread Xionghu Luo via Gcc-patches
When spliting edge with self loop, the split edge should be placed just next to the edge_in->src, otherwise it may generate different position latch bbs for two consecutive self loops. For details, please refer to: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93680#c4 Regression tested pass on

Ping: [PATCH v4] rs6000: Fix incorrect RTL for Power LE when removing the UNSPECS [PR106069]

2023-02-27 Thread Xionghu Luo via Gcc-patches
Hi Segher, Ping this for stage 4... On 2023/2/10 10:59, Xionghu Luo via Gcc-patches wrote: Resend this patch... v4: Update per comments. v3: rename altivec_vmrghb_direct_le to altivec_vmrglb_direct_le to match the actual output ASM vmrglb. Likewise for all similar xxx_direct_le patterns. v2

[PATCH v4] rs6000: Fix incorrect RTL for Power LE when removing the UNSPECS [PR106069]

2023-02-09 Thread Xionghu Luo via Gcc-patches
Resend this patch... v4: Update per comments. v3: rename altivec_vmrghb_direct_le to altivec_vmrglb_direct_le to match the actual output ASM vmrglb. Likewise for all similar xxx_direct_le patterns. v2: Split the direct pattern to be and le with same RTL but different insn. The native RTL

Re: Ping: [PATCH v4] rs6000: Fix incorrect RTL for Power LE when removing the UNSPECS [PR106069]

2023-02-08 Thread Xionghu Luo via Gcc-patches
Thanks Kewen! Ping this again @Segher. Maybe we could also merge this patch if no objections from Segher as several reviews and tests taken on this already... BR, Xionghu On 2023/1/18 17:11, Kewen.Lin wrote: Hi Segher, I guessed that this patch escaped from your radar. :) As Jakub asked

Ping: [PATCH v4] rs6000: Fix incorrect RTL for Power LE when removing the UNSPECS [PR106069]

2022-08-23 Thread Xionghu Luo via Gcc-patches
Hi Segher, I'd like to resend and ping for this patch. Thanks. From 23bffdacdf0eb1140c7a3571e6158797f4818d57 Mon Sep 17 00:00:00 2001 From: Xionghu Luo Date: Thu, 4 Aug 2022 03:44:58 + Subject: [PATCH v4] rs6000: Fix incorrect RTL for Power LE when removing the UNSPECS [PR106069] v4:

Re: [PATCH v4] rs6000: Fix incorrect RTL for Power LE when removing the UNSPECS [PR106069]

2022-08-17 Thread Xionghu Luo via Gcc-patches
On 2022/8/16 14:53, Kewen.Lin wrote: Hi Xionghu, Thanks for the updated version of patch, some comments are inlined. on 2022/8/11 14:15, Xionghu Luo wrote: On 2022/8/11 01:07, Segher Boessenkool wrote: On Wed, Aug 10, 2022 at 02:39:02PM +0800, Xionghu Luo wrote: On 2022/8/9 11:01,

Re: [PATCH v2] rs6000: Fix incorrect RTL for Power LE when removing the UNSPECS [PR106069]

2022-08-11 Thread Xionghu Luo via Gcc-patches
On 2022/8/11 01:07, Segher Boessenkool wrote: On Wed, Aug 10, 2022 at 02:39:02PM +0800, Xionghu Luo wrote: On 2022/8/9 11:01, Kewen.Lin wrote: I have some concern on those changed "altivec_*_direct", IMHO the suffix "_direct" is normally to indicate the define_insn is mapped to the

Re: [PATCH v2] rs6000: Fix incorrect RTL for Power LE when removing the UNSPECS [PR106069]

2022-08-10 Thread Xionghu Luo via Gcc-patches
On 2022/8/9 11:01, Kewen.Lin wrote: Hi Xionghu, Thanks for the fix. on 2022/8/8 11:42, Xionghu Luo wrote: The native RTL expression for vec_mrghw should be same for BE and LE as they are register and endian-independent. So both BE and LE need generate exactly same RTL with index [0 4 1 5]

[PATCH] rs6000: Fix incorrect RTL for Power LE when removing the UNSPECS [PR106069]

2022-08-07 Thread Xionghu Luo via Gcc-patches
The native RTL expression for vec_mrghw should be same for BE and LE as they are register and endian-independent. So both BE and LE need generate exactly same RTL with index [0 4 1 5] when expanding vec_mrghw with vec_select and vec_concat. (set (reg:V4SI 141) (vec_select:V4SI (vec_concat:V8SI

[PATCH] Fix typo

2022-06-22 Thread Xionghu Luo via Gcc-patches
Fix typo and commit as obvious. Signed-off-by: Xionghu Luo gcc/ChangeLog: * cgraph.cc (cgraph_edge::redirect_call_stmt_to_callee): Fix typo. * tree-ssa-loop-ivopts.cc (struct iv_cand): Likewise. * tree-switch-conversion.h: Likewise. --- gcc/cgraph.cc

[PATCH] Fix ICE when multiple speculative targets are expanded in different ltrans unit [PR93318]

2022-06-22 Thread Xionghu Luo via Gcc-patches
There is a corner case for speculative multiple targets, that if speculative edges are streamed to different ltrans units, and then edges are expanded in one ltrans unit but the speculative property is not cleared by resolve_speculation in other ltrans unit finally cause ICE. This patch fixes

Re: [PATCH] if-to-switch: Don't skip the first condition bb when find_conditions in if-to-switch [PR105740]

2022-06-21 Thread Xionghu Luo via Gcc-patches
On 2022/6/21 15:42, Martin Liška wrote: On 6/21/22 09:33, Xi Ruoyao wrote: On Tue, 2022-06-21 at 09:28 +0200, Martin Liška wrote: Sorry, but I don't see to which email this replies to? Can't find a patch. https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596913.html Hm, interesting.

Re: [PATCH] if-to-switch: Don't skip the first condition bb when find_conditions in if-to-switch [PR105740]

2022-06-21 Thread Xionghu Luo via Gcc-patches
On 2022/6/21 15:33, Richard Biener via Gcc-patches wrote: On Tue, Jun 21, 2022 at 5:06 AM xionghuluo(罗雄虎) via Gcc-patches wrote: Bootstrap and regression tested pass on x86_64-linux-gnu, OK for master? OK if you add a comment that an empty conditions_in_bbs indicates we are processing

Re: [PATCH] if-to-switch: Don't skip the first condition bb when find_conditions in if-to-switch [PR105740]

2022-06-20 Thread Xionghu Luo via Gcc-patches
Correct the format...  test2: .LFB0:         .cfi_startproc         xorl    %edx, %edx         cmpl    $3, (%rdi)         jle     .L1         movl    16(%rdi), %eax         cmpl    $1, %eax         je      .L4         subl    $2, %eax         cmpl    $4, %eax         ja      .L1         movl    

Re: Ping: [PATCH] rs6000: Add split pattern to replace

2022-01-10 Thread Xionghu Luo via Gcc-patches
On 2022/1/11 06:55, David Edelsohn wrote: >>> +(define_insn_and_split "sldoi_to_mov_" > It would be more consistent with the naming convention to use > "sldoi_to_mov" without the final "_". OK, thanks. > >>> + [(set (match_operand:VM 0 "altivec_register_operand") >>> + (unspec:VM

[PATCH] testsuite: Fix regression on m32 by r12-6087 [PR103820]

2022-01-10 Thread Xionghu Luo via Gcc-patches
r12-6087 will avoid move cold bb out of hot loop, while the original intent of this testcase is to hoist divides out of loop and CSE them to only one divide. So increase the loop count to turn the cold bb to hot bb again. Then the 3 divides could be rewritten with same reciptmp. Tested pass on

Ping: [PATCH] rs6000: powerpc suboptimal boolean test of contiguous bits [PR102239]

2022-01-09 Thread Xionghu Luo via Gcc-patches
Ping, thanks. On 2021/12/13 13:16, Xionghu Luo wrote: > Add specialized version to combine two instructions from > > 9: {r123:CC=cmp(r124:DI&0x6,0);clobber scratch;} >REG_DEAD r124:DI > 10: pc={(r123:CC==0)?L15:pc} > REG_DEAD r123:CC > > to: > > 10:

Ping: [PATCH] rs6000: Add split pattern to replace

2022-01-09 Thread Xionghu Luo via Gcc-patches
Gentle ping, thanks. On 2021/12/29 09:27, Xionghu Luo wrote: > 7: r120:V4SI=const_vector > 8: r121:V4SI=unspec[r120:V4SI,r120:V4SI,0xc] 260 > > with r121:v4SI = r120:V4SI when r120 is a vector with same element. > > Bootstrapped and regtested pass on powerpc64le-linux-gnu {P10, P9} > and

Re: [PATCH 1/3] loop-invariant: Don't move cold bb instructions to preheader in RTL

2021-12-29 Thread Xionghu Luo via Gcc-patches
On 2021/12/29 20:55, Jan Hubicka wrote: >>> >>> From: Xiong Hu Luo >>> >>> gcc/ChangeLog: >>> >>> * loop-invariant.c (find_invariants_bb): Check profile count >>> before motion. >>> (find_invariants_body): Add argument. >>> >>> gcc/testsuite/ChangeLog: >>> >>> *

Re: [PATCH 1/3] loop-invariant: Don't move cold bb instructions to preheader in RTL

2021-12-28 Thread Xionghu Luo via Gcc-patches
On 2021/12/17 09:30, Xionghu Luo via Gcc-patches wrote: > > > On 2021/12/16 19:20, Jan Hubicka wrote: >>> >>> OK. Comments like? >>> >>> /* Don't move insn of cold BB out of loop to preheader to reduce >>> calculations &

[PATCH] rs6000: Add split pattern to replace

2021-12-28 Thread Xionghu Luo via Gcc-patches
7: r120:V4SI=const_vector 8: r121:V4SI=unspec[r120:V4SI,r120:V4SI,0xc] 260 with r121:v4SI = r120:V4SI when r120 is a vector with same element. Bootstrapped and regtested pass on powerpc64le-linux-gnu {P10, P9} and powerpc64-linux-gnu {P8, P7}. OK for master? gcc/ChangeLog: *

[PATCH] convert (xor (and (xor A B) C) A) to (ior (and A ~C) (and B C)) [PR90323]

2021-12-28 Thread Xionghu Luo via Gcc-patches
Bootstrapped and regtested on powerpc64le-linux-gnu {P10,P9} powerpc64-linux-gnu {P8, P7} and X86. OK for master? gcc/ChangeLog: PR 90323 * simplify-rtx.c (simplify_context::simplify_binary_operation_1): Relax C from constant to constant or reg. gcc/testsuite/ChangeLog:

Re: [PATCH] Fix ICE in lsplit when built with -O3 -fno-guess-branch-probability [PR103793]

2021-12-28 Thread Xionghu Luo via Gcc-patches
On 2021/12/29 03:33, Jan Hubicka wrote: >> -/* Proportion second loop's bb counts except those dominated by false >> - branch to avoid drop 1s down. */ >> -basic_block bbi_copy = get_bb_copy (false_edge->dest); >> -bbs2 = get_loop_body (loop2); >> -for (j = 0; j <

[PATCH] Fix ICE in lsplit when built with -O3 -fno-guess-branch-probability [PR103793]

2021-12-21 Thread Xionghu Luo via Gcc-patches
no-guess-branch-probability option requires profile_count with initialized_p guard. Also merge the missed part of r12-6086 of factor out function to avoid duplicate code. gcc/ChangeLog: PR 103793 * tree-ssa-loop-split.c (fix_loop_bb_probability): New function.

Re: [PATCH v8 2/2] Don't move cold code out of loop by checking bb count

2021-12-20 Thread Xionghu Luo via Gcc-patches
On 2021/12/20 15:29, Richard Biener wrote: > On Wed, Dec 8, 2021 at 7:32 AM Xionghu Luo wrote: >> >> >> >> On 2021/12/7 20:17, Richard Biener wrote: > + class loop *coldest_loop = coldest_outermost_loop[loop->num]; > + if (loop_depth (coldest_loop) < loop_depth (outermost_loop))

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

2021-12-20 Thread Xionghu Luo via Gcc-patches
On 2021/12/13 16:57, Xionghu Luo via Gcc-patches wrote: > > > On 2021/12/9 07:47, Jeff Law wrote: >>> diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c >>> index 3f6ad046623..33128061aab 100644 >>> --- a/gcc/tree-ssa-loop-split.c

Re: [PATCH 2/3] Fix incorrect loop exit edge probability [PR103270]

2021-12-20 Thread Xionghu Luo via Gcc-patches
On 2021/12/16 19:18, Jan Hubicka wrote: >>> >>> >>> ./contrib/analyze_brprob.py ~/workspace/tests/spec2017/dump_file_all >>> HEURISTICS BRANCHES (REL) BR. HITRATE >>> HITRATE COVERAGE COVERAGE (REL) predict.def (REL) HOT >>> branches (>10%)

Re: [PATCH] rs6000: Replace UNSPECS with ss_plus/us_plus and ss_minus/us_minus

2021-12-20 Thread Xionghu Luo via Gcc-patches
On 2021/12/21 09:32, David Edelsohn wrote: > Explicit clobbers like this help one side of the issue. For vscr, other > than the sat bit there is only the nj bit, and we just ignore that :-) > >> This patch is okay. Thanks for updating the machine description and >> for cleaning up the

Re: [PATCH] rs6000: Replace UNSPECS with ss_plus/us_plus and ss_minus/us_minus

2021-12-20 Thread Xionghu Luo via Gcc-patches
On 2021/12/21 10:19, Xionghu Luo via Gcc-patches wrote: > > > On 2021/12/21 09:32, David Edelsohn wrote: >> On Mon, Dec 20, 2021 at 6:55 PM Segher Boessenkool >> wrote: >>> >>> On Mon, Dec 20, 2021 at 11:45:45AM -0500, David Edelsohn wrote: >>&

Re: [PATCH] rs6000: Replace UNSPECS with ss_plus/us_plus and ss_minus/us_minus

2021-12-20 Thread Xionghu Luo via Gcc-patches
On 2021/12/21 09:32, David Edelsohn wrote: > On Mon, Dec 20, 2021 at 6:55 PM Segher Boessenkool > wrote: >> >> On Mon, Dec 20, 2021 at 11:45:45AM -0500, David Edelsohn wrote: >>> On Mon, Dec 20, 2021 at 3:24 AM Xionghu Luo wrote: These four UNSPECS seems could be replaced with native

[PATCH] rs6000: Replace UNSPECS with ss_plus/us_plus and ss_minus/us_minus

2021-12-20 Thread Xionghu Luo via Gcc-patches
These four UNSPECS seems could be replaced with native RTL, and why "(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))" in the RTL pattern, per ISA of VSCR bit 127(VECTOR Saturation, SAT): This bit is sticky; that is, once set to 1 it remains set to 1 until it is set to 0

Re: [PATCH 1/3] loop-invariant: Don't move cold bb instructions to preheader in RTL

2021-12-16 Thread Xionghu Luo via Gcc-patches
On 2021/12/16 19:20, Jan Hubicka wrote: >> >> OK. Comments like? >> >> /* Don't move insn of cold BB out of loop to preheader to reduce calculations >>and register live range in hot loop with cold BB. */ > > Looks good. >> >> >> And maybe some dump log will help tracking in

Re: [PATCH] Verbose support in analyze_brprob_spec

2021-12-15 Thread Xionghu Luo via Gcc-patches
On 2021/12/15 18:34, Martin Liška wrote: > On 12/15/21 02:58, Xionghu Luo wrote: >> Also add verbose argument support like analyze_brprob.py >> >> contrib/ChangeLog: >> >> * analyze_brprob_spec.py: Add verbose argument. >> --- >>   contrib/analyze_brprob_spec.py | 1 + >>   1 file changed, 1

Re: [PATCH 2/3] Fix incorrect loop exit edge probability [PR103270]

2021-12-14 Thread Xionghu Luo via Gcc-patches
On 2021/12/14 17:27, Xionghu Luo via Gcc-patches wrote: > > > On 2021/12/13 17:25, Jan Hubicka wrote: >>> r12-4526 cancelled jump thread path rotates loop. It exposes a issue in >>> profile-estimate when predict_extra_loop_exits, outer loop's exit edge >>>

[PATCH] Verbose support in analyze_brprob_spec

2021-12-14 Thread Xionghu Luo via Gcc-patches
Also add verbose argument support like analyze_brprob.py contrib/ChangeLog: * analyze_brprob_spec.py: Add verbose argument. --- contrib/analyze_brprob_spec.py | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/analyze_brprob_spec.py b/contrib/analyze_brprob_spec.py index

Re: [PATCH 2/3] Fix incorrect loop exit edge probability [PR103270]

2021-12-14 Thread Xionghu Luo via Gcc-patches
On 2021/12/13 17:25, Jan Hubicka wrote: >> r12-4526 cancelled jump thread path rotates loop. It exposes a issue in >> profile-estimate when predict_extra_loop_exits, outer loop's exit edge >> is marked as inner loop's extra loop exit and set with incorrect >> prediction, then a hot inner loop

Re: [PATCH 1/3] loop-invariant: Don't move cold bb instructions to preheader in RTL

2021-12-14 Thread Xionghu Luo via Gcc-patches
On 2021/12/13 18:24, Jan Hubicka wrote: >>> gcc/ChangeLog: >>> >>> * loop-invariant.c (find_invariants_bb): Check profile count >>> before motion. >>> (find_invariants_body): Add argument. >>> --- >>> gcc/loop-invariant.c | 10 +++--- >>> 1 file changed, 7 insertions(+), 3

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

2021-12-13 Thread Xionghu Luo via Gcc-patches
On 2021/12/9 07:47, Jeff Law wrote: >> diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c >> index 3f6ad046623..33128061aab 100644 >> --- a/gcc/tree-ssa-loop-split.c >> +++ b/gcc/tree-ssa-loop-split.c >> >> @@ -607,6 +610,38 @@ split_loop (class loop *loop1) >>   tree

[PATCH] rs6000: powerpc suboptimal boolean test of contiguous bits [PR102239]

2021-12-12 Thread Xionghu Luo via Gcc-patches
Add specialized version to combine two instructions from 9: {r123:CC=cmp(r124:DI&0x6,0);clobber scratch;} REG_DEAD r124:DI 10: pc={(r123:CC==0)?L15:pc} REG_DEAD r123:CC to: 10: {pc={(r123:DI&0x6==0)?L15:pc};clobber scratch;clobber %0:CC;} then split2 will split

Re: [PATCH v8 2/2] Don't move cold code out of loop by checking bb count

2021-12-07 Thread Xionghu Luo via Gcc-patches
On 2021/12/7 20:17, Richard Biener wrote: >>> + class loop *coldest_loop = coldest_outermost_loop[loop->num]; >>> + if (loop_depth (coldest_loop) < loop_depth (outermost_loop)) >>> +{ >>> + class loop *hotter_loop = hotter_than_inner_loop[loop->num]; >>> + if (!hotter_loop >>> +

[PATCH 3/3] Fix loop split incorrect count and probability

2021-12-07 Thread Xionghu Luo via Gcc-patches
In tree-ssa-loop-split.c, split_loop and split_loop_on_cond does two kind of split. split_loop only works for single loop and insert edge at exit when split, while split_loop_on_cond is not limited to single loop and insert edge at latch when split. Both split behavior should consider loop count

[PATCH 2/3] Fix incorrect loop exit edge probability [PR103270]

2021-12-07 Thread Xionghu Luo via Gcc-patches
r12-4526 cancelled jump thread path rotates loop. It exposes a issue in profile-estimate when predict_extra_loop_exits, outer loop's exit edge is marked as inner loop's extra loop exit and set with incorrect prediction, then a hot inner loop will become cold loop finally through optimizations,

[PATCH 1/3] loop-invariant: Don't move cold bb instructions to preheader in RTL

2021-12-07 Thread Xionghu Luo via Gcc-patches
gcc/ChangeLog: * loop-invariant.c (find_invariants_bb): Check profile count before motion. (find_invariants_body): Add argument. --- gcc/loop-invariant.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gcc/loop-invariant.c

[PATCH 0/3] Dependency patches for hoist LIM code to cold loop

2021-12-07 Thread Xionghu Luo via Gcc-patches
This patchset is a recollect of previously sent patches. Thanks Richard that The "Don't move cold code out of loop by checking bb count" is approved[1], but there are still 3 prerequesite patches to supplement or avoid regression. 1) Patch [1/3] is the RTL part of not hoisting LIM code out of

Re: [PATCH v8 2/2] Don't move cold code out of loop by checking bb count

2021-12-05 Thread Xionghu Luo via Gcc-patches
On 2021/12/6 13:09, Xionghu Luo via Gcc-patches wrote: > > > On 2021/12/1 18:09, Richard Biener wrote: >> On Wed, Nov 10, 2021 at 4:08 AM Xionghu Luo wrote: >>> >>> >>> >>> On 2021/11/4 21:00, Richard Biener wrote: >

Ping: [PATCH v2] Fix incorrect loop exit edge probability [PR103270]

2021-12-05 Thread Xionghu Luo via Gcc-patches
Hi Honza, Gentle ping for this :), thanks. https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585289.html On 2021/11/24 13:03, Xionghu Luo via Gcc-patches wrote: > On 2021/11/23 17:50, Jan Hubicka wrote: >>> On Tue, Nov 23, 2021 at 6:52 AM Xionghu Luo wrote: >>>>

Re: [PATCH v8 2/2] Don't move cold code out of loop by checking bb count

2021-12-05 Thread Xionghu Luo via Gcc-patches
On 2021/12/1 18:09, Richard Biener wrote: > On Wed, Nov 10, 2021 at 4:08 AM Xionghu Luo wrote: >> >> >> >> On 2021/11/4 21:00, Richard Biener wrote: >>> On Wed, Nov 3, 2021 at 2:29 PM Xionghu Luo wrote: > + while (outmost_loop != loop) > +{ > + if

Ping: [PATCH v7 2/2] Don't move cold code out of loop by checking bb count

2021-11-23 Thread Xionghu Luo via Gcc-patches
Gentle ping and is this patch still suitable for stage 3? Thanks. [PATCH v7 2/2] Don't move cold code out of loop by checking bb count https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583911.html On 2021/11/10 11:08, Xionghu Luo via Gcc-patches wrote: > > > On 2021/1

Re: [PATCH v3 1/4] Fix loop split incorrect count and probability

2021-11-23 Thread Xionghu Luo via Gcc-patches
Gentle ping, thanks. [PATCH v3] Fix loop split incorrect count and probability https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583626.html On 2021/11/8 14:09, Xionghu Luo via Gcc-patches wrote: > > > On 2021/10/27 15:44, Jan Hubicka wrote: >>> On Wed, 27 Oct 2021,

[PATCH v2] Fix incorrect loop exit edge probability [PR103270]

2021-11-23 Thread Xionghu Luo via Gcc-patches
On 2021/11/23 17:50, Jan Hubicka wrote: >> On Tue, Nov 23, 2021 at 6:52 AM Xionghu Luo wrote: >>> >>> r12-4526 cancelled jump thread path rotates loop. It exposes a issue in >>> profile-estimate when predict_extra_loop_exits, outer loop's exit edge >>> is marked as inner loop's extra loop exit

Re: [PATCH] Fix incorrect loop exit edge probability [PR103270]

2021-11-22 Thread Xionghu Luo via Gcc-patches
On 2021/11/23 13:51, Xionghu Luo wrote: > r12-4526 cancelled jump thread path rotates loop. It exposes a issue in > profile-estimate when predict_extra_loop_exits, outer loop's exit edge > is marked as inner loop's extra loop exit and set with incorrect > prediction, then a hot inner loop will

[PATCH] Fix incorrect loop exit edge probability [PR103270]

2021-11-22 Thread Xionghu Luo via Gcc-patches
r12-4526 cancelled jump thread path rotates loop. It exposes a issue in profile-estimate when predict_extra_loop_exits, outer loop's exit edge is marked as inner loop's extra loop exit and set with incorrect prediction, then a hot inner loop will become cold loop finally through optimizations,

[PATCH v7 2/2] Don't move cold code out of loop by checking bb count

2021-11-09 Thread Xionghu Luo via Gcc-patches
On 2021/11/4 21:00, Richard Biener wrote: > On Wed, Nov 3, 2021 at 2:29 PM Xionghu Luo wrote: >> >> >>> + while (outmost_loop != loop) >>> +{ >>> + if (bb_colder_than_loop_preheader (loop_preheader_edge >>> (outmost_loop)->src, >>> +

Re: [PATCH v3 1/4] Fix loop split incorrect count and probability

2021-11-07 Thread Xionghu Luo via Gcc-patches
On 2021/10/27 15:44, Jan Hubicka wrote: >> On Wed, 27 Oct 2021, Jan Hubicka wrote: >> gcc/ChangeLog: * tree-ssa-loop-split.c (split_loop): Fix incorrect probability. (do_split_loop_on_cond): Likewise. --- gcc/tree-ssa-loop-split.c | 25

Re: [PATCH] rs6000: Fix incorrect fusion constraint [PR102991]

2021-11-05 Thread Xionghu Luo via Gcc-patches
On 2021/11/5 08:58, David Edelsohn wrote: > On Thu, Nov 4, 2021 at 8:50 PM Xionghu Luo wrote: > >> [PATCH] rs6000: Fix incorrect fusion constraint [PR102991] >> >> gcc/ChangeLog: >> >> * config/rs6000/fusion.md: Regenerate. >> * config/rs6000/genfusion.pl: Fix incorrect

Re: [PATCH] rs6000: Fix incorrect fusion constraint [PR102991]

2021-11-04 Thread Xionghu Luo via Gcc-patches
On 2021/11/4 09:59, David Edelsohn wrote: > On Wed, Nov 3, 2021 at 9:46 PM Xionghu Luo wrote: >> >> On 2021/11/3 23:13, David Edelsohn wrote: >>> Did you manually change fusion.md or did you regenerate it after >>> fixing genfusion.pl? >>> >>> If you regenerated it, the ChangeLog entry should

Re: [PATCH] rs6000: Fix incorrect fusion constraint [PR102991]

2021-11-03 Thread Xionghu Luo via Gcc-patches
On 2021/11/3 23:13, David Edelsohn wrote: > Did you manually change fusion.md or did you regenerate it after > fixing genfusion.pl? > > If you regenerated it, the ChangeLog entry should be "Regenerated" and > the "Fix incorrect clobber constraint." should refer to the > genfusion.pl change. >

Re: [RFC] Don't move cold code out of loop by checking bb count

2021-11-03 Thread Xionghu Luo via Gcc-patches
On 2021/10/29 19:48, Richard Biener wrote: > I'm talking about the can_sm_ref_p call, in that context 'loop' will > be the outermost loop of > interest, and we are calling this for all stores in a loop. We're doing > > +bool > +ref_in_loop_hot_body::operator () (mem_ref_loc *loc) > +{ > +

[PATCH] rs6000: Fix incorrect fusion constraint [PR102991]

2021-11-03 Thread Xionghu Luo via Gcc-patches
The clobber constraint should match operand's constraint. fusion.md was generated by genfusion.pl, but it is disabled now, update both places with correct clobber constraint. gcc/ChangeLog: * config/rs6000/fusion.md: Fix incorrect clobber constraint. *

Re: [RFC] Don't move cold code out of loop by checking bb count

2021-11-03 Thread Xionghu Luo via Gcc-patches
On 2021/10/29 19:48, Richard Biener wrote: > I'm talking about the can_sm_ref_p call, in that context 'loop' will > be the outermost loop of > interest, and we are calling this for all stores in a loop. We're doing > > +bool > +ref_in_loop_hot_body::operator () (mem_ref_loc *loc) > +{ > +

Re: [PATCH v2 2/4] Refactor loop_version

2021-10-31 Thread Xionghu Luo via Gcc-patches
On 2021/10/29 19:52, Richard Biener wrote: > On Wed, 27 Oct 2021, Xionghu Luo wrote: > >> loop_version currently does lv_adjust_loop_entry_edge >> before it loopifys the copy inserted on the header. This patch moves >> the condition generation later and thus we have four pieces to help >>

[PATCH v2] rs6000: Optimize __builtin_shuffle when it's used to zero the upper bits [PR102868]

2021-10-27 Thread Xionghu Luo via Gcc-patches
On 2021/10/27 21:24, David Edelsohn wrote: > On Sun, Oct 24, 2021 at 10:51 PM Xionghu Luo wrote: >> >> If the second operand of __builtin_shuffle is const vector 0, and with >> specific mask, it can be optimized to vspltisw+xxpermdi instead of lxv. >> >> gcc/ChangeLog: >> >> *

Re: [RFC] Don't move cold code out of loop by checking bb count

2021-10-27 Thread Xionghu Luo via Gcc-patches
On 2021/10/27 20:54, Jan Hubicka wrote: >> Hi, >> >> On 2021/9/28 20:09, Richard Biener wrote: >>> On Fri, Sep 24, 2021 at 8:29 AM Xionghu Luo wrote: Update the patch to v3, not sure whether you prefer the paste style and continue to link the previous thread as Segher dislikes

[PATCH v2 4/4] Rename duplicate_loop_to_header_edge to duplicate_loop_body_to_header_edge

2021-10-27 Thread Xionghu Luo via Gcc-patches
gcc/ChangeLog: * cfghooks.c (cfg_hook_duplicate_loop_to_header_edge): Rename duplicate_loop_to_header_edge to duplicate_loop_body_to_header_edge. (cfg_hook_duplicate_loop_body_to_header_edge): Likewise. * cfghooks.h (struct cfg_hooks): Likewise.

[PATCH v2 3/4] Rename loop_version to clone_loop_to_header_edge.

2021-10-27 Thread Xionghu Luo via Gcc-patches
Name loop_copy is used in gcc/cfg.c already. gcc/ChangeLog: * cfgloopmanip.c (force_single_succ_latches): Rename loop_version to clone_loop_to_header_edge. (lv_adjust_loop_entry_edge): Likewise. (loop_version): Likewise. (clone_loop_to_header_edge):

[PATCH v2 2/4] Refactor loop_version

2021-10-27 Thread Xionghu Luo via Gcc-patches
loop_version currently does lv_adjust_loop_entry_edge before it loopifys the copy inserted on the header. This patch moves the condition generation later and thus we have four pieces to help understanding of how the adjustment works: 1) duplicating the loop on the entry edge. 2) loopify the

[PATCH v2 1/4] Fix loop split incorrect count and probability

2021-10-27 Thread Xionghu Luo via Gcc-patches
loop split condition is moved between loop1 and loop2, the split bb's count and probability should also be duplicated instead of (100% vs INV), secondly, the original loop1 and loop2 count need be propotional from the original loop. Regression tested pass, OK for master? diff

[PATCH v2 0/4] loop split fix and functions renaming

2021-10-27 Thread Xionghu Luo via Gcc-patches
This patchset is an followed update from [1]. Patch 1 is expecting review comments from Honza[2]; Patch 2 refactors loop_version to remove loopify call and adjust condition generation later than loopify; Patch 3 and Patch 4 are function renamings to help better understanding. [1]

Re: [RFC] Don't move cold code out of loop by checking bb count

2021-10-26 Thread Xionghu Luo via Gcc-patches
On 2021/10/26 21:20, Richard Biener wrote: > On Mon, Oct 18, 2021 at 6:29 AM Xionghu Luo wrote: >> >> >> >> On 2021/10/15 16:11, Richard Biener wrote: >>> On Sat, Oct 9, 2021 at 5:45 AM Xionghu Luo wrote: Hi, On 2021/9/28 20:09, Richard Biener wrote: > On Fri, Sep 24,

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

2021-10-26 Thread Xionghu Luo via Gcc-patches
On 2021/10/26 21:05, Jan Hubicka wrote: >>> > >> That said, likely the profile update cannot be done uniformly >> for all blocks of a loop? > > For the loop: > > for (i = 0; i < n; i = inc (i)) > { > if (ga) > ga = do_something (); > } > > to: > > for (i = 0; i < x; i =

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

2021-10-25 Thread Xionghu Luo via Gcc-patches
On 2021/10/21 18:55, Richard Biener wrote: > On Thu, 21 Oct 2021, Xionghu Luo wrote: > >> >> >> On 2021/10/15 13:51, Xionghu Luo via Gcc-patches wrote: >>> >>> >>> On 2021/9/23 20:17, Richard Biener wrote: >>>> On Wed, 22 Sep 202

[PATCH] rs6000: Optimize __builtin_shuffle when it's used to zero the upper bits [PR102868]

2021-10-24 Thread Xionghu Luo via Gcc-patches
If the second operand of __builtin_shuffle is const vector 0, and with specific mask, it can be optimized to vspltisw+xxpermdi instead of lxv. gcc/ChangeLog: * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Add patterns match and emit for VSX xxpermdi.

Re: Ping^3: [PATCH v2 0/2] Fix vec_sel code generation and merge xxsel to vsel

2021-10-21 Thread Xionghu Luo via Gcc-patches
Ping^3, thanks. https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579637.html On 2021/10/15 14:28, Xionghu Luo via Gcc-patches wrote: > Ping^2, thanks. > > https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579637.html > > > On 2021/10/8 09:17, Xionghu Luo via

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

2021-10-21 Thread Xionghu Luo via Gcc-patches
On 2021/10/15 13:51, Xionghu Luo via Gcc-patches wrote: > > > On 2021/9/23 20:17, Richard Biener wrote: >> On Wed, 22 Sep 2021, Xionghu Luo wrote: >> >>> >>> >>> On 2021/8/11 17:16, Richard Biener wrote: >>>> On Wed, 11 Aug 2021,

[PATCH v5 2/2] Don't move cold code out of loop by checking bb count

2021-10-18 Thread Xionghu Luo via Gcc-patches
On 2021/10/18 12:29, Xionghu Luo via Gcc-patches wrote: > > > On 2021/10/15 16:11, Richard Biener wrote: >> On Sat, Oct 9, 2021 at 5:45 AM Xionghu Luo wrote: >>> >>> Hi, >>> >>> On 2021/9/28 20:09, Richard Biener wrote: >

Re: [RFC] Don't move cold code out of loop by checking bb count

2021-10-17 Thread Xionghu Luo via Gcc-patches
On 2021/10/15 16:11, Richard Biener wrote: > On Sat, Oct 9, 2021 at 5:45 AM Xionghu Luo wrote: >> >> Hi, >> >> On 2021/9/28 20:09, Richard Biener wrote: >>> On Fri, Sep 24, 2021 at 8:29 AM Xionghu Luo wrote: Update the patch to v3, not sure whether you prefer the paste style

Ping^2: [PATCH v2 0/2] Fix vec_sel code generation and merge xxsel to vsel

2021-10-15 Thread Xionghu Luo via Gcc-patches
Ping^2, thanks. https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579637.html On 2021/10/8 09:17, Xionghu Luo via Gcc-patches wrote: > Ping, thanks. > > > On 2021/9/17 13:25, Xionghu Luo wrote: >> These two patches are updated version from: >> https://gcc.gnu.o

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

2021-10-14 Thread Xionghu Luo via Gcc-patches
On 2021/9/23 20:17, Richard Biener wrote: > On Wed, 22 Sep 2021, Xionghu Luo wrote: > >> >> >> On 2021/8/11 17:16, Richard Biener wrote: >>> On Wed, 11 Aug 2021, Xionghu Luo wrote: >>> On 2021/8/10 22:47, Richard Biener wrote: > On Mon, 9 Aug 2021, Xionghu Luo wrote: >

Re: Ping ^ 2: [PATCH] rs6000: Remove unspecs for vec_mrghl[bhw]

2021-10-12 Thread Xionghu Luo via Gcc-patches
Thanks David, On 2021/10/13 06:51, David Edelsohn wrote: > Hi, Xionghu > > What's the status of the \M and \m testcase beautification requested > by Segher? Did you send an updated patch? Your messages ping the > version prior to Segher's additional comments. The pinged link already answered

[PATCH v2] rs6000: Remove unspecs for vec_mrghl[bhw]

2021-10-12 Thread Xionghu Luo via Gcc-patches
Resend this patch. Previous discussion is: https://gcc.gnu.org/pipermail/gcc-patches/2021-June/572330.html vmrghb only accepts permute index {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23} no matter for BE or LE in ISA, similarly for vmrglb. Remove

Re: [RFC] Don't move cold code out of loop by checking bb count

2021-10-08 Thread Xionghu Luo via Gcc-patches
Hi, On 2021/9/28 20:09, Richard Biener wrote: > On Fri, Sep 24, 2021 at 8:29 AM Xionghu Luo wrote: >> >> Update the patch to v3, not sure whether you prefer the paste style >> and continue to link the previous thread as Segher dislikes this... >> >> >> [PATCH v3] Don't move cold code out of loop

Ping: [PATCH v2 0/2] Fix vec_sel code generation and merge xxsel to vsel

2021-10-07 Thread Xionghu Luo via Gcc-patches
Ping, thanks. On 2021/9/17 13:25, Xionghu Luo wrote: > These two patches are updated version from: > https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579490.html > > Changes: > 1. Fix alignment error in md files. > 2. Replace rtx_equal_p with match_dup. > 3. Use register_operand instead

Re: [RFC] Don't move cold code out of loop by checking bb count

2021-09-24 Thread Xionghu Luo via Gcc-patches
Update the patch to v3, not sure whether you prefer the paste style and continue to link the previous thread as Segher dislikes this... [PATCH v3] Don't move cold code out of loop by checking bb count Changes: 1. Handle max_loop in determine_max_movement instead of outermost_invariant_loop. 2.

Re: [RFC] Don't move cold code out of loop by checking bb count

2021-09-22 Thread Xionghu Luo via Gcc-patches
On 2021/9/23 10:13, Xionghu Luo via Gcc-patches wrote: On 2021/9/22 17:14, Richard Biener wrote: On Thu, Sep 9, 2021 at 3:56 AM Xionghu Luo wrote: On 2021/8/26 19:33, Richard Biener wrote: On Tue, Aug 10, 2021 at 4:03 AM Xionghu Luo wrote: Hi, On 2021/8/6 20:15, Richard Biener

Re: [RFC] Don't move cold code out of loop by checking bb count

2021-09-22 Thread Xionghu Luo via Gcc-patches
On 2021/9/22 17:14, Richard Biener wrote: On Thu, Sep 9, 2021 at 3:56 AM Xionghu Luo wrote: On 2021/8/26 19:33, Richard Biener wrote: On Tue, Aug 10, 2021 at 4:03 AM Xionghu Luo wrote: Hi, On 2021/8/6 20:15, Richard Biener wrote: On Mon, Aug 2, 2021 at 7:05 AM Xiong Hu Luo wrote:

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

2021-09-22 Thread Xionghu Luo via Gcc-patches
On 2021/8/11 17:16, Richard Biener wrote: On Wed, 11 Aug 2021, Xionghu Luo wrote: On 2021/8/10 22:47, Richard Biener wrote: On Mon, 9 Aug 2021, Xionghu Luo wrote: Thanks, On 2021/8/6 19:46, Richard Biener wrote: On Tue, 3 Aug 2021, Xionghu Luo wrote: loop split condition is moved

Re: Ping ^ 3: [PATCH] rs6000: Fix wrong code generation for vec_sel [PR94613]

2021-09-16 Thread Xionghu Luo via Gcc-patches
Other than that question / suggestion, this patch is okay. Please coordinate with Bill and his builtin patches. OK. Thanks, David On Wed, Sep 15, 2021 at 3:50 AM Xionghu Luo wrote: Ping^3, thanks. https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570333.html On 2021/9/6 08:52, Xionghu Lu

[PATCH v2 1/2] rs6000: Fix wrong code generation for vec_sel [PR94613]

2021-09-16 Thread Xionghu Luo via Gcc-patches
The vsel instruction is a bit-wise select instruction. Using an IF_THEN_ELSE to express it in RTL is wrong and leads to wrong code being generated in the combine pass. Per element selection is a subset of per bit-wise selection,with the patch the pattern is written using bit operations. But

  1   2   3   >