[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

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

[RFC] Run store-merging pass once more before pass fre/pre

2020-02-18 Thread Xionghu Luo
Store-merging pass should run twice, the reason is pass fre/pre will do some kind of optimizations to instructions by: 1. Converting the load from address to load from function arguments (store_merging_30.c:foo1). 2. Converting the byte access to BIT_FIELD_REF(store_merging_30.c:foo2). 3. O

[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

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

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

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

[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

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

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

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

[PATCH] rs6000: Fix vec insert ilp32 ICE and test failures [PR98799]

2021-01-25 Thread Xionghu Luo via Gcc-patches
n and make them static. The previous commit r11-6858 missed check m32, This patch is tested pass on P7BE{m32,m64}/P8BE{m32,m64}/P8LE/P9LE with RUNTESTFLAGS="--target_board =unix'{-m32,-m64}" for BE targets. gcc/ChangeLog: 2021-01-26 Xionghu Luo David Edel

Re: [PATCH] rs6000: Fix vec insert ilp32 ICE and test failures [PR98799]

2021-01-26 Thread Xionghu Luo via Gcc-patches
Hi, On 2021/1/27 03:00, David Edelsohn wrote: > On Tue, Jan 26, 2021 at 2:46 AM Xionghu Luo wrote: >> >> From: "luo...@cn.ibm.com" >> >> UNSPEC_SI_FROM_SF is not supported when TARGET_DIRECT_MOVE_64BIT >> is false for -m32, don't generate VIE

[PATCH] testsuite: Run vec_insert case on P8 and P9 with option specified

2021-01-28 Thread Xionghu Luo via Gcc-patches
Move common functions to header file for cleanup. gcc/testsuite/ChangeLog: 2021-01-27 Xionghu Luo * gcc.target/powerpc/pr79251.p8.c: Move definition to ... * gcc.target/powerpc/pr79251.h: ...this. * gcc.target/powerpc/pr79251.p9.c: Likewise. * gcc.target

[PATCH] testsuite: Update pr79251 ilp32 store regex.

2021-01-31 Thread Xionghu Luo via Gcc-patches
BE ilp32 Linux generates extra stack stwu instructions which shouldn't be counted in, \m … \M is needed around each instruction, not just the beginning and end of the entire pattern. Pre-approved, committing. gcc/testsuite/ChangeLog: 2021-02-01 Xionghu Luo * gcc.target/po

[PATCH] rs6000: Convert the vector element register to SImode [PR98914]

2021-02-03 Thread Xionghu Luo via Gcc-patches
be signed int by ELFv2 ABI, so convert it to SImode if it wasn't for Power target requirements. gcc/ChangeLog: 2021-02-03 Xionghu Luo * config/rs6000/rs6000.c (rs6000_expand_vector_set): Convert elt_rtx to SImode if it wasn't. gcc/testsuite/ChangeLog: 202

Ping: [PATCH] rs6000: Convert the vector element register to SImode [PR98914]

2021-02-17 Thread Xionghu Luo via Gcc-patches
Gentle ping, thanks. On 2021/2/3 17:01, Xionghu Luo wrote: v[k] will also be expanded to IFN VEC_SET if k is long type when built with -Og. -O0 didn't exposed the issue due to v is TREE_ADDRESSABLE, -O1 and above also didn't capture it because of v[k] is not optimized to VIEW_CONV

[PATCH v2] rs6000: Convert the vector element register to SImode [PR98914]

2021-02-23 Thread Xionghu Luo via Gcc-patches
vec_insert defines the element argument type to be signed int by ELFv2 ABI, When expanding a vector with a variable rtx, convert the rtx type SImode. gcc/ChangeLog: 2021-02-24 Xionghu Luo PR target/98914 * config/rs6000/rs6000.c (rs6000_expand_vector_set): Convert

Re: [PATCH v2] rs6000: Convert the vector element register to SImode [PR98914]

2021-02-24 Thread Xionghu Luo via Gcc-patches
On 2021/2/25 00:57, Segher Boessenkool wrote: > Hi! > > On Wed, Feb 24, 2021 at 09:06:24AM +0800, Xionghu Luo wrote: >> vec_insert defines the element argument type to be signed int by ELFv2 >> ABI, When expanding a vector with a variable rtx, convert the rtx type >&g

Ping: [PATCH v2] rs6000: Convert the vector element register to SImode [PR98914]

2021-03-02 Thread Xionghu Luo via Gcc-patches
On 2021/2/25 14:33, Xionghu Luo via Gcc-patches wrote: > > > On 2021/2/25 00:57, Segher Boessenkool wrote: >> Hi! >> >> On Wed, Feb 24, 2021 at 09:06:24AM +0800, Xionghu Luo wrote: >>> vec_insert defines the element argument type to be signed int by ELFv2 &

[PATCH] Fix loop split incorrect count and probability

2021-08-03 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

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

2021-08-03 Thread Xionghu Luo via Gcc-patches
17 00:00:00 2001 From: Xionghu Luo Date: Tue, 3 Aug 2021 03:44:14 -0500 Subject: [PATCH 1/2] Fix loop split incorrect count and probability 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), sec

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

2021-08-08 Thread Xionghu Luo via Gcc-patches
Thanks, On 2021/8/6 19:46, Richard Biener wrote: > On Tue, 3 Aug 2021, Xionghu Luo wrote: > >> 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 origin

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

2021-08-09 Thread Xionghu Luo via Gcc-patches
Hi, On 2021/8/6 20:15, Richard Biener wrote: > On Mon, Aug 2, 2021 at 7:05 AM Xiong Hu Luo wrote: >> >> There was a patch trying to avoid move cold block out of loop: >> >> https://gcc.gnu.org/pipermail/gcc/2014-November/215551.html >> >> Richard suggested to "never hoist anything from a bb with

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

2021-08-11 Thread Xionghu Luo via Gcc-patches
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 between loop

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

2021-08-11 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: [PATCH] Fix incorrect computation in fill_always_executed_in_1

2021-08-16 Thread Xionghu Luo via Gcc-patches
Hi, On 2021/8/16 19:46, Richard Biener wrote: On Mon, 16 Aug 2021, Xiong Hu Luo wrote: It seems to me that ALWAYS_EXECUTED_IN is not computed correctly for nested loops. inn_loop is updated to inner loop, so it need be restored when exiting from innermost loop. With this patch, the store inst

Re: [PATCH] Fix incorrect computation in fill_always_executed_in_1

2021-08-16 Thread Xionghu Luo via Gcc-patches
On 2021/8/17 13:17, Xionghu Luo via Gcc-patches wrote: Hi, On 2021/8/16 19:46, Richard Biener wrote: On Mon, 16 Aug 2021, Xiong Hu Luo wrote: It seems to me that ALWAYS_EXECUTED_IN is not computed correctly for nested loops.  inn_loop is updated to inner loop, so it need be restored when

[PATCH v2] Fix incomplete computation in fill_always_executed_in_1

2021-08-17 Thread Xionghu Luo via Gcc-patches
On 2021/8/17 15:12, Richard Biener wrote: > On Tue, 17 Aug 2021, Xionghu Luo wrote: > >> Hi, >> >> On 2021/8/16 19:46, Richard Biener wrote: >>> On Mon, 16 Aug 2021, Xiong Hu Luo wrote: >>> >>>> It seems to me that ALWAYS_EXECUTED_IN is n

Re: [PATCH v2] Fix incomplete computation in fill_always_executed_in_1

2021-08-18 Thread Xionghu Luo via Gcc-patches
On 2021/8/17 17:10, Xionghu Luo via Gcc-patches wrote: > > > On 2021/8/17 15:12, Richard Biener wrote: >> On Tue, 17 Aug 2021, Xionghu Luo wrote: >> >>> Hi, >>> >>> On 2021/8/16 19:46, Richard Biener wrote: >>>> On Mon, 16

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

2021-08-18 Thread Xionghu Luo via Gcc-patches
On 2021/8/10 12:25, Ulrich Drepper wrote: > On Tue, Aug 10, 2021 at 4:03 AM Xionghu Luo via Gcc-patches > wrote: >> For this case, theorotically I think the master GCC will optimize it to: >> >>invariant; >>for (;;) >>

Re: [PATCH v2] Fix incomplete computation in fill_always_executed_in_1

2021-08-24 Thread Xionghu Luo via Gcc-patches
On 2021/8/19 20:11, Richard Biener wrote: >> - class loop *inn_loop = loop; >> >> if (ALWAYS_EXECUTED_IN (loop->header) == NULL) >> { >> @@ -3232,19 +3231,6 @@ fill_always_executed_in_1 (class loop *loop, sbitmap >> contains_call) >> to disprove this if possible). */ >>

Re: [PATCH v3] Fix incomplete computation in fill_always_executed_in_1

2021-08-25 Thread Xionghu Luo via Gcc-patches
On 2021/8/24 16:20, Richard Biener wrote: > On Tue, 24 Aug 2021, Xionghu Luo wrote: > >> >> >> On 2021/8/19 20:11, Richard Biener wrote: >>>> - class loop *inn_loop = loop; >>>> >>>> if (ALWAYS_EXECUTED_IN (l

Re: [PATCH v3] Fix incomplete computation in fill_always_executed_in_1

2021-08-30 Thread Xionghu Luo via Gcc-patches
On 2021/8/27 15:45, Richard Biener wrote: On Thu, 26 Aug 2021, Xionghu Luo wrote: On 2021/8/24 16:20, Richard Biener wrote: On Tue, 24 Aug 2021, Xionghu Luo wrote: On 2021/8/19 20:11, Richard Biener wrote: - class loop *inn_loop = loop; if (ALWAYS_EXECUTED_IN (loop

Re: [PATCH v3] Fix incomplete computation in fill_always_executed_in_1

2021-08-31 Thread Xionghu Luo via Gcc-patches
On 2021/8/30 17:19, Richard Biener wrote: bitmap_set_bit (work_set, loop->header->index); + unsigned bb_index; - for (i = 0; i < loop->num_nodes; i++) - { - edge_iterator ei; - bb = bbs[i]; + unsigned array_size = last_basic_block_for_fn (cfun) + 1;

[PATCH v3 1/2] IFN: Implement IFN_VEC_SET for ARRAY_REF with VIEW_CONVERT_EXPR

2020-09-21 Thread xionghu luo via Gcc-patches
ARRAY_REF(VIEW_CONVERT_EXPR) to VEC_SET internal function in gimple-isel pass if target supports vec_set with variable index by checking can_vec_set_var_idx_p. gcc/ChangeLog: 2020-09-22 Xionghu Luo * gimple-isel.cc (gimple_expand_vec_set_expr): New function. (gimple_expand_v

Re: [PATCH v3 1/2] IFN: Implement IFN_VEC_SET for ARRAY_REF with VIEW_CONVERT_EXPR

2020-09-23 Thread xionghu luo via Gcc-patches
_set_expr (&gsi);" up as your comments. Thanks again. IFN: Implement IFN_VEC_SET for ARRAY_REF with VIEW_CONVERT_EXPR This patch enables transformation from ARRAY_REF(VIEW_CONVERT_EXPR) to VEC_SET internal function in gimple-isel pass if target supports vec_set with variable ind

Re: [PATCH v2 2/2] rs6000: Expand vec_insert in expander instead of gimple [PR79251]

2020-09-24 Thread xionghu luo via Gcc-patches
use SI for index param. rs6000_expand_vector_set could accept insert either to constant position or variable position, so change the operand to reg_or_cint_operand. gcc/ChangeLog: 2020-09-24 Xionghu Luo * config/rs6000/altivec.md (altivec_lvsl_reg): Change to SImode. (altiv

Re: [PATCH v2 2/2] rs6000: Expand vec_insert in expander instead of gimple [PR79251]

2020-09-24 Thread xionghu luo via Gcc-patches
Hi, On 2020/9/24 21:27, Richard Biener wrote: > On Thu, Sep 24, 2020 at 10:21 AM xionghu luo wrote: > > I'll just comment that > > xxperm 34,34,33 > xxinsertw 34,0,12 > xxperm 34,34,32 > > doesn't look like a variable-positi

[PATCH v4 1/3] IFN: Implement IFN_VEC_SET for ARRAY_REF with VIEW_CONVERT_EXPR

2020-09-24 Thread xionghu luo via Gcc-patches
Hi, On 2020/9/24 20:39, Richard Sandiford wrote: > xionghu luo writes: >> @@ -2658,6 +2659,43 @@ expand_vect_cond_mask_optab_fn (internal_fn, gcall >> *stmt, convert_optab optab) >> >> #define expand_vec_cond_mask_optab_fn expand_vect_cond_mask_optab_fn >>

Re: [PATCH v4 1/3] IFN: Implement IFN_VEC_SET for ARRAY_REF with VIEW_CONVERT_EXPR

2020-09-26 Thread xionghu luo via Gcc-patches
On 2020/9/25 21:28, Richard Sandiford wrote: > xionghu luo writes: >> @@ -2658,6 +2659,45 @@ expand_vect_cond_mask_optab_fn (internal_fn, gcall >> *stmt, convert_optab optab) >> >> #define expand_vec_cond_mask_optab_fn expand_vect_cond_mask_optab_fn >>

[PATCH 1/4] rs6000: Change rs6000_expand_vector_set param

2020-10-10 Thread Xionghu Luo via Gcc-patches
rs6000_expand_vector_set could accept insert either to constant position or variable position, so change the operand to reg_or_cint_operand. gcc/ChangeLog: 2020-10-10 Xionghu Luo * config/rs6000/rs6000-call.c (altivec_expand_vec_set_builtin): Change call param 2 from type int

[PATCH 4/4] rs6000: Update testcases' instruction count

2020-10-10 Thread Xionghu Luo via Gcc-patches
gcc/testsuite/ChangeLog: 2020-10-10 Xionghu Luo * gcc.target/powerpc/fold-vec-insert-char-p8.c: Adjust instruction counts. * gcc.target/powerpc/fold-vec-insert-char-p9.c: Likewise. * gcc.target/powerpc/fold-vec-insert-double.c: Likewise. * gcc.target

[PATCH 3/4] rs6000: Enable vec_insert for P8 with rs6000_expand_vector_set_var_p8

2020-10-10 Thread Xionghu Luo via Gcc-patches
gcc/ChangeLog: 2020-10-10 Xionghu Luo * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Generate ARRAY_REF(VIEW_CONVERT_EXPR) for P8 and later platforms. * config/rs6000/rs6000.c (rs6000_expand_vector_set_var): Update to call different

[PATCH 2/4] rs6000: Support variable insert and Expand vec_insert in expander [PR79251]

2020-10-10 Thread Xionghu Luo via Gcc-patches
,6 lvsl 0,0,6 xxperm 34,34,33 xxinsertw 34,0,12 xxperm 34,34,32 Though instructions increase from 5 to 7, the performance is improved 60% in typical cases. Tested with V2DI, V2DF V4SI, V4SF, V8HI, V16QI on Power9-LE. gcc/ChangeLog: 2020-10-10 Xionghu Luo

[PATCH 0/4] rs6000: Enable variable vec_insert with IFN VEC_SET

2020-10-10 Thread Xionghu Luo via Gcc-patches
instruction sequences. Xionghu Luo (4): rs6000: Change rs6000_expand_vector_set param rs6000: Support variable insert and Expand vec_insert in expander [PR79251] rs6000: Enable vec_insert for P8 with rs6000_expand_vector_set_var_p8 rs6000: Update testcases' instruction count gcc/config/r

[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

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

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

[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

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

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

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

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

Ping: [PATCH 0/4] rs6000: Enable variable vec_insert with IFN VEC_SET

2020-11-04 Thread Xionghu Luo via Gcc-patches
Ping. On 2020/10/10 16:08, Xionghu Luo wrote: Originated from https://gcc.gnu.org/pipermail/gcc-patches/2020-September/554240.html with patch split and some refinement per review comments. Patch of IFN VEC_SET for ARRAY_REF(VIEW_CONVERT_EXPR) is committed, this patch set enables expanding IFN

Ping^2: [PATCH 0/4] rs6000: Enable variable vec_insert with IFN VEC_SET

2020-11-12 Thread Xionghu Luo via Gcc-patches
Ping^2, thanks. On 2020/11/5 09:34, Xionghu Luo via Gcc-patches wrote: Ping. On 2020/10/10 16:08, Xionghu Luo wrote: Originated from https://gcc.gnu.org/pipermail/gcc-patches/2020-September/554240.html with patch split and some refinement per review comments. Patch of IFN VEC_SET for

Re: [PATCH] rs6000: Don't split constant operator add before reload, move to temp register for future optimization

2020-11-13 Thread Xionghu Luo via Gcc-patches
Hi, On 2020/10/27 05:10, Segher Boessenkool wrote: > On Wed, Oct 21, 2020 at 03:25:29AM -0500, Xionghu Luo wrote: >> Don't split code from add3 for SDI to allow a later pass to split. > > This is very problematic. > >> This allows later logic to hoist out cons

Re: [PATCH] tree-optimization/102155 - fix LIM fill_always_executed_in CFG walk

2021-09-01 Thread Xionghu Luo via Gcc-patches
On 2021/9/1 17:58, Richard Biener wrote: This fixes the CFG walk order of fill_always_executed_in to use RPO oder rather than the dominator based order computed by get_loop_body_in_dom_order. That fixes correctness issues with unordered dominator children. The RPO order computed by rev_post_

Re: [PATCH] tree-optimization/102155 - fix LIM fill_always_executed_in CFG walk

2021-09-02 Thread Xionghu Luo via Gcc-patches
On 2021/9/2 16:50, Richard Biener wrote: > On Thu, 2 Sep 2021, Richard Biener wrote: > >> On Thu, 2 Sep 2021, Xionghu Luo wrote: >> >>> >>> >>> On 2021/9/1 17:58, Richard Biener wrote: >>>> This fixes the CFG walk order of fill_always_e

Re: Ping ^ 2: [PATCH] rs6000: Expand fmod and remainder when built with fast-math [PR97142]

2021-09-02 Thread Xionghu Luo via Gcc-patches
f0,f0 fnmsubs f1,f2,f0,f1 SPEC2017 Ofast P8LE: 511.povray_r +1.14%, 526.blender_r +1.72% gcc/ChangeLog: 2021-09-03 Xionghu Luo PR target/97142 * config/rs6000/rs6000.md (fmod3): New define_expand. (remainder3): Likewise. gcc/testsuite/ChangeLog: 2021-

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

2021-09-05 Thread Xionghu Luo via Gcc-patches
Ping^2, thanks. https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570333.html On 2021/6/30 09:42, Xionghu Luo via Gcc-patches wrote: Gentle ping, thanks. https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570333.html On 2021/5/14 14:57, Xionghu Luo via Gcc-patches wrote: Hi, On 2021/5/13

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

2021-09-05 Thread Xionghu Luo via Gcc-patches
Ping^2, thanks. https://gcc.gnu.org/pipermail/gcc-patches/2021-June/572330.html On 2021/6/30 09:47, Xionghu Luo via Gcc-patches wrote: Gentle ping, thanks. https://gcc.gnu.org/pipermail/gcc-patches/2021-June/572330.html On 2021/6/9 16:03, Xionghu Luo via Gcc-patches wrote: Hi, On 2021/6

Re: Ping ^ 2: [PATCH] rs6000: Expand fmod and remainder when built with fast-math [PR97142]

2021-09-06 Thread Xionghu Luo via Gcc-patches
On 2021/9/4 05:44, Segher Boessenkool wrote: Hi! On Fri, Sep 03, 2021 at 10:31:24AM +0800, Xionghu Luo wrote: fmod/fmodf and remainder/remainderf could be expanded instead of library call when fast-math build, which is much faster. Thank you very much for this patch. Some trivial

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

2021-09-08 Thread Xionghu Luo via Gcc-patches
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: There was a patch trying to avoid move cold block out of loop: https://gcc.gnu.org/pipermail

Re: [PATCH] tree-optimization/102155 - fix LIM fill_always_executed_in CFG walk

2021-09-08 Thread Xionghu Luo via Gcc-patches
On 2021/9/2 18:37, Richard Biener wrote: On Thu, 2 Sep 2021, Xionghu Luo wrote: On 2021/9/2 16:50, Richard Biener wrote: On Thu, 2 Sep 2021, Richard Biener wrote: On Thu, 2 Sep 2021, Xionghu Luo wrote: On 2021/9/1 17:58, Richard Biener wrote: This fixes the CFG walk order of

Re: [PATCH] tree-optimization/102155 - fix LIM fill_always_executed_in CFG walk

2021-09-10 Thread Xionghu Luo via Gcc-patches
On 2021/9/9 18:55, Richard Biener wrote: diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 5d6845478e7..4b187c2cdaf 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -3074,15 +3074,13 @@ fill_always_executed_in_1 (class loop *loop, sbitmap contains_call)

Re: [PATCH] tree-optimization/102155 - fix LIM fill_always_executed_in CFG walk

2021-09-12 Thread Xionghu Luo via Gcc-patches
On 2021/9/10 21:54, Xionghu Luo via Gcc-patches wrote: On 2021/9/9 18:55, Richard Biener wrote: diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 5d6845478e7..4b187c2cdaf 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -3074,15 +3074,13

Re: [PATCH] tree-optimization/102155 - fix LIM fill_always_executed_in CFG walk

2021-09-13 Thread Xionghu Luo via Gcc-patches
On 2021/9/13 16:17, Richard Biener wrote: On Mon, 13 Sep 2021, Xionghu Luo wrote: On 2021/9/10 21:54, Xionghu Luo via Gcc-patches wrote: On 2021/9/9 18:55, Richard Biener wrote: diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 5d6845478e7..4b187c2cdaf 100644 --- a

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

2021-09-15 Thread Xionghu Luo via Gcc-patches
Ping^3, thanks. https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570333.html On 2021/9/6 08:52, Xionghu Luo via Gcc-patches wrote: Ping^2, thanks. https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570333.html On 2021/6/30 09:42, Xionghu Luo via Gcc-patches wrote: Gentle ping, thanks

[PATCH v2 2/2] rs6000: Fold xxsel to vsel since they have same semantics

2021-09-16 Thread Xionghu Luo via Gcc-patches
Fold xxsel to vsel like xxperm/vperm to avoid duplicate code. gcc/ChangeLog: 2021-09-17 Xionghu Luo * config/rs6000/altivec.md: Add vsx register constraints. * config/rs6000/vsx.md (vsx_xxsel): Delete. (vsx_xxsel2): Likewise. (vsx_xxsel3): Likewise

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

2021-09-16 Thread Xionghu Luo via Gcc-patches
tested pass on P8LE. Xionghu Luo (2): rs6000: Fix wrong code generation for vec_sel [PR94613] rs6000: Fold xxsel to vsel since they have same semantics gcc/config/rs6000/altivec.md | 84 ++- gcc/config/rs6000/rs6000-call.c | 62 ++ gcc

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

2021-09-16 Thread Xionghu Luo via Gcc-patches
t it won't swap (op2&op3) | (~op3&op1) to (~op3&op1) | (op2&op3), so this patch handles it with 4 patterns with different NOT op3 position and check equality inside it. Tested pass on Power8LE, any comments? gcc/ChangeLog: 2021-09-17 Xionghu Luo

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

2021-09-16 Thread Xionghu Luo via Gcc-patches
ns? 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,

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

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] 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: [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-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 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 --

  1   2   3   >