Re: [PATCH] libgcov: Fix gcov overlap bugs of divide to 0

2023-10-26 Thread Xionghu Luo
+cc maintainers. On 2023/10/26 11:25, Xionghu Luo wrote: Fix the long lasting issue of `gcov-tool overlap xxx yyy`, divide to 0 caused the output shows a lot of nans, another problem is the counts in file are never acculated leads to incorrect results. Signed-off-by: Xionghu Luo libgcc

[PATCH] libgcov: Fix gcov overlap bugs of divide to 0

2023-10-25 Thread Xionghu Luo
Fix the long lasting issue of `gcov-tool overlap xxx yyy`, divide to 0 caused the output shows a lot of nans, another problem is the counts in file are never acculated leads to incorrect results. Signed-off-by: Xionghu Luo libgcc/ChangeLog: * libgcov-util.c (compute_one_gcov): Avoid

[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
: Check whether two locus are on same line. Start a new basic block if two labels have different location when test-coverage. Regression tested pass on x86_64-linux-gnu and aarch64-linux-gnu, OK for master? 2023-03-22 Xionghu Luo Richard Biener gcc/ChangeLog: PR gcov/93680

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.

[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
y_by_resolution_info): Check node's externally_visiable with function instead of variable. (function_and_variable_visibility): New parameter whole_program. Signed-off-by: Xionghu Luo --- gcc/ipa-visibility.cc | 13 + 1 file changed, 9 insertions(+), 4 deletion

[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

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

[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
PR gcov/93680 * g++.dg/gcov/gcov-1.C: Correct counts. * gcc.misc-tests/gcov-4.c: Likewise. * gcc.misc-tests/gcov-pr85332.c: Likewise. * lib/gcov.exp: Also clean gcda if fail. * gcc.misc-tests/gcov-pr93680.c: New test. Signed-off-by: Xionghu Luo -

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 (". &

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:

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 <= &#x

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

2023-03-01 Thread Xionghu Luo via Gcc-patches
PR gcov/97923 * gcov.cc (line_info::line_info): Init id. (solve_flow_graph): Fix typo. (add_line_counts): Set line->id. * gimplify.cc (shortcut_cond_r): Correct cond expr op0 location. gcc/testsuite/ChangeLog: PR gcov/97923 * gc

[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
on x86_64-linux-gnu and aarch64-linux-gnu, OK for master? gcc/ChangeLog: PR gcov/93680 * tree-cfg.cc (split_edge_bb_loc): Return edge_in->src for self loop. gcc/testsuite/ChangeLog: PR gcov/93680 * gcc.misc-tests/gcov-pr93680.c: New test. Signed-off-by: Xiong

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
.cc (altivec_expand_vec_perm_const): Adjust. * config/rs6000/vsx.md: Likewise. gcc/testsuite/ChangeLog: PR target/106069 * g++.target/powerpc/pr106069.C: New test. Signed-off-by: Xionghu Luo --- gcc/config/rs6000/altivec.md| 222 ++-- gcc/config/rs6000/rs6000

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
clear than before, it looked good to me. What do you think of this? Looking forward to your opinion. btw, the link in archives: https://gcc.gnu.org/pipermail/gcc-patches/2022-August/600169.html BR, Kewen on 2022/8/24 09:24, Xionghu Luo wrote: 主题: Ping: [PATCH v4] rs6000: Fix incorrect RTL fo

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

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

2022-08-16 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-10 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_i

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

2022-08-09 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
ise. gcc/testsuite/ChangeLog: PR target/106069 * gcc.target/powerpc/pr106069.C: New test. Signed-off-by: Xionghu Luo --- gcc/config/rs6000/altivec.md| 122 gcc/config/rs6000/rs6000.cc | 36 +++--- gcc/config/rs6000/vsx

[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
: Xionghu Luo gcc/ChangeLog: PR ipa/93318 * cgraph.cc (cgraph_edge::resolve_speculation): Remove speculative info if no indirect edge found. * cgraph.h: Return NULL if the edges are resloved in other ltrans units. * tree-inline.cc (copy_bb): Only

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. I

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 th

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    C

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 [(match

[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 P

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 > >

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-g

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: >>> >>> * gcc.dg/loop-inva

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 >>> calculati

[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: * config/rs6

[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 < loop2->n

[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. (split_loop

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]; >>>>> +

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 formatt

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

[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 b

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 xxx.c.271r.lo

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/analyz

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 e621853

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 wi

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 delet

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 guard_n

[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 i

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 a

[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, this

[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 b/gcc/loop-invarian

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

2021-12-07 Thread Xionghu Luo via Gcc-patches
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585195.html [4] https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585290.html Xionghu Luo (3): loop-invariant: Don't move cold bb instructions to preheader in RTL Fix incorrect loop exit edge probability [PR103270] Fix loop

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: >>>> >>>> >&g

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 2

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 >>

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

[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, this

[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 (l

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-04 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. >> *

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? >>> >>>

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) > +{ > + bas

[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. * config/rs6000/genfusion.pl:

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) > +{ > + bas

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

[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/

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 >>>&

[PATCH v2 4/4] Rename duplicate_loop_to_header_edge to duplicate_loop_body_to_header_edge

2021-10-26 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. (cfg

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

2021-10-26 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): Likewis

[PATCH v2 2/4] Refactor loop_version

2021-10-26 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 dupl

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

2021-10-26 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 base/loop-cond-split

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

2021-10-26 Thread Xionghu Luo via Gcc-patches
://gcc.gnu.org/pipermail/gcc-patches/2021-October/582600.html [2] https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582607.html Xionghu Luo (4): Fix loop split incorrect count and probability Refactor loop_version Rename loop_version to clone_loop_to_header_edge. Rename

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, >>>

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. gcc/testsuite/Chan

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

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

2021-10-14 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

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 Se

[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 UNSPEC_VMRGH_DIRECT/UNSPEC_VMRGL_DIREC

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... >> >> >> [PAT

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 reg

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

2021-09-23 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

  1   2   3   >