Re: [PATCH] aarch64:sve: Use create_tmp_reg_or_ssa_name instead of create_tmp_var in the folder

2025-06-01 Thread Andrew Pinski
On Sun, Jun 1, 2025 at 3:54 AM Richard Biener wrote: > > On Sat, May 31, 2025 at 8:41 PM Andrew Pinski > wrote: > > > > Currently gimple_folder::convert_and_fold calls create_tmp_var; that means > > while in ssa form, > > the pass which calls fold_stmt will a

[PATCH v2] aarch64:sve: Use make_ssa_name instead of create_tmp_var in the folder

2025-06-01 Thread Andrew Pinski
ad of create_tmp_var for the temporary. Add comment about callback argument. Signed-off-by: Andrew Pinski --- gcc/config/aarch64/aarch64-sve-builtins.cc | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch6

[PATCH] forwprop: Manually rename the virtual mem op for complex and vector loads prop

2025-05-31 Thread Andrew Pinski
definition is before the first use. (pass_forwprop::execute): Likewise for complex loads. (pass_data_forwprop): Remove TODO_update_ssa. Signed-off-by: Andrew Pinski --- gcc/tree-ssa-forwprop.cc | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/tree-ssa

[PATCH] aarch64:sve: Use create_tmp_reg_or_ssa_name instead of create_tmp_var in the folder

2025-05-31 Thread Andrew Pinski
geLog: * config/aarch64/aarch64-sve-builtins.cc (gimple_folder::convert_and_fold): Use create_tmp_reg_or_ssa_name instead of create_tmp_var for the temporary. Signed-off-by: Andrew Pinski --- gcc/config/aarch64/aarch64-sve-builtins.cc | 2 +- 1 file changed, 1 insertion(

[PATCH] DCE: Only set TODO_update_ssa when cfg has changed

2025-05-31 Thread Andrew Pinski
-ssa-dce.cc (perform_tree_ssa_dce): Set TODO_update_ssa only when cfg has changed Signed-off-by: Andrew Pinski --- gcc/tree-ssa-dce.cc | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/tree-ssa-dce.cc b/gcc/tree-ssa-dce.cc index ba9cd6536ae..f5e67c4409a 100644

[PATCH] CCP: Manually rename the virtual mem op when inserting clobbers

2025-05-31 Thread Andrew Pinski
cp.cc (insert_clobber_before_stack_restore): Update the virtual op on the inserted clobber and the stack restore function. (do_ssa_ccp): Don't add TODO_update_ssa to the todo. Signed-off-by: Andrew Pinski --- gcc/tree-ssa-ccp.cc | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff -

[PATCH] Have TODO_verify_* not set by any pass

2025-05-30 Thread Andrew Pinski
s_data_early_vrp): Remove TODO_verify_all. (pass_data_fast_vrp): Likewise. Signed-off-by: Andrew Pinski --- gcc/function.h| 1 - gcc/gimple-harden-conditionals.cc | 6 ++ gcc/gimple-harden-control-flow.cc | 3 +-- gcc/ipa-strub.cc

[PUSHED] Fix typo in comment in execute_all_ipa_transforms.

2025-05-30 Thread Andrew Pinski
small typo, missing n at the end of function. Pushed as obvious after a bootstrap/test. gcc/ChangeLog: * passes.cc (execute_all_ipa_transforms): Fix typo in commenet. Signed-off-by: Andrew Pinski --- gcc/passes.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

Re: [PATCH] widening_mul: Make better use of overflowing operations in codegen of min/max(a, add/sub(a, b))

2025-05-30 Thread Andrew Pinski
On Thu, May 29, 2025 at 1:05 AM wrote: > > From: Dhruv Chawla > > This patch folds the following patterns: > - max (a, add (a, b)) -> [sum, ovf] = addo (a, b); !ovf ? sum : a > - max (a, sub (a, b)) -> [sum, ovf] = subo (a, b); !ovf ? a : sum > - min (a, add (a, b)) -> [sum, ovf] = addo (a, b); !

[PATCH] scc_copy: conditional return TODO_cleanup_cfg.

2025-05-29 Thread Andrew Pinski
::replace_scc_by_value): Return true if something was done. (scc_copy_prop::propagate): Return true if something was changed. (pass_sccopy::execute): Return TODO_cleanup_cfg if a prop happened. Signed-off-by: Andrew Pinski --- gcc/gimple-ssa-sccopy.cc | 20 1 file

Re: [PATCH 1/2] forwprop: Change test in loop of optimize_memcpy_to_memset

2025-05-29 Thread Andrew Pinski
On Tue, May 27, 2025 at 5:14 AM Richard Biener wrote: > > On Tue, May 27, 2025 at 5:02 AM Andrew Pinski > wrote: > > > > This was noticed in the review of copy propagation for aggregates > > patch, instead of checking for a NULL or a non-ssa name of vuse, > >

Re: [PATCH] gimple-fold: Implement simple copy propagation for aggregates [PR14295]

2025-05-28 Thread Andrew Pinski
On Mon, May 26, 2025 at 1:40 PM Andrew Pinski wrote: > > Note this is redundant store removal - I'm not sure operand_equal_p > > is good enough to catch all cases of effective type changes done? > > Esp. as infering the old effective type from the read side (src2) > &g

Re: [PATCH] Improve copy prop for aggregates and combine with zeroing case

2025-05-28 Thread Andrew Pinski
On Fri, May 23, 2025 at 10:12 PM Andrew Pinski wrote: > > This improves copy prop for aggregates by working over statements that don't > modify the access > just like how it is done for copying zeros. > To speed up things, we should only have one loop back on the vuse in

Re: [PATCH] gimple-fold: Implement simple copy propagation for aggregates [PR14295]

2025-05-28 Thread Andrew Pinski
On Mon, May 26, 2025 at 1:40 PM Andrew Pinski wrote: > > On Mon, May 26, 2025 at 5:36 AM Richard Biener > wrote: > > > > On Sun, May 18, 2025 at 10:58 PM Andrew Pinski > > wrote: > > > > > > This implements a simple copy propagation for aggregates

[PATCH 1/2] forwprop: Change test in loop of optimize_memcpy_to_memset

2025-05-26 Thread Andrew Pinski
(optimize_memcpy_to_memset): Change check from NULL/non-ssa name to default name. Signed-off-by: Andrew Pinski --- gcc/tree-ssa-forwprop.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index 4c048a9a298

[PATCH 2/2] forwprop: Add stats for memcpy->memset

2025-05-26 Thread Andrew Pinski
hen the statement changed. Signed-off-by: Andrew Pinski --- gcc/tree-ssa-forwprop.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index e457a69ed48..81ea7d4195e 100644 --- a/gcc/tree-ssa-forwprop.cc +++ b/gcc/tree-ssa-forwprop.cc @@ -132

Re: [PATCH] gimple-fold: Implement simple copy propagation for aggregates [PR14295]

2025-05-26 Thread Andrew Pinski
On Mon, May 26, 2025 at 1:40 PM Andrew Pinski wrote: > > On Mon, May 26, 2025 at 5:36 AM Richard Biener > wrote: > > > > On Sun, May 18, 2025 at 10:58 PM Andrew Pinski > > wrote: > > > > > > This implements a simple copy propagation for aggregates

Re: [PATCH] gimple-fold: Implement simple copy propagation for aggregates [PR14295]

2025-05-26 Thread Andrew Pinski
On Mon, May 26, 2025 at 5:36 AM Richard Biener wrote: > > On Sun, May 18, 2025 at 10:58 PM Andrew Pinski > wrote: > > > > This implements a simple copy propagation for aggregates in the similar > > fashion as we already do for copy prop of zeroing. > > >

Re: [PATCH] testsuite: Fix pr101145inf*.c testcases [PR117494]

2025-05-26 Thread Andrew Pinski
On Mon, May 26, 2025 at 4:57 AM Christophe Lyon wrote: > > ,, > > On Mon, 26 May 2025 at 12:54, Andrew Pinski (QUIC) > wrote: > > > > > -Original Message- > > > From: Christophe Lyon > > > Sent: Monday, May 26, 2025 3:09 AM >

RE: [PATCH] testsuite: Fix pr101145inf*.c testcases [PR117494]

2025-05-26 Thread Andrew Pinski (QUIC)
> -Original Message- > From: Christophe Lyon > Sent: Monday, May 26, 2025 3:09 AM > To: Andrew Pinski (QUIC) > Cc: gcc-patches@gcc.gnu.org > Subject: Re: [PATCH] testsuite: Fix pr101145inf*.c testcases > [PR117494] > > Hi Andrew, > > On Sun, 17 Nov 2024

Re: [AUTOFDO][AARCH64] Add support for profilebootstrap

2025-05-25 Thread Andrew Pinski
GS=u,k > >> + shift > >> +fi > >> + > >> +if [ "$use_brbe" = true ] ; then > >> + if grep -q hypervisor /proc/cpuinfo ; then > >> +echo >&2 "Warning: branch profiling may not be functional in VMs" > >> +

Re: [PATCH] match: Undo maybe_push_res_to_seq in some cases [PR120331]

2025-05-23 Thread Andrew Pinski
On Fri, May 23, 2025 at 2:39 AM Richard Biener wrote: > > On Thu, May 22, 2025 at 3:11 AM Jeff Law wrote: > > > > > > > > On 5/18/25 10:38 AM, Andrew Pinski wrote: > > > While working on improving forwprop and removal of > > > forward_propagate_in

[PATCH] Improve copy prop for aggregates and combine with zeroing case

2025-05-23 Thread Andrew Pinski
test. * gcc.dg/tree-ssa/copy-prop-arg-2.c: New test. * gcc.dg/tree-ssa/copy-prop-arg-3.c: New test. Signed-off-by: Andrew Pinski --- .../gcc.dg/tree-ssa/copy-prop-arg-1.c | 37 + .../gcc.dg/tree-ssa/copy-prop-arg-2.c | 35 .../gcc.dg/tree-ssa/copy-prop-arg-3.c

Re: [PATCH] combine: gen_lowpart_no_emit vs CLOBBER [PR120090]

2025-05-21 Thread Andrew Pinski
On Wed, May 21, 2025 at 3:21 PM Jeff Law wrote: > > > > On 5/5/25 3:27 PM, Andrew Pinski wrote: > > The problem here is simplify-rtx.cc expects gen_lowpart_no_emit > > to return NULL on failure but combine's hook was returning CLOBBER. > > After r16-160-ge6f89d

Re: [PATCH] testsuite: aarch64: arm: Fix -mcpu=unset support in shared effective targets

2025-05-21 Thread Andrew Pinski
On Tue, May 20, 2025, 1:47 PM Christophe Lyon wrote: > Many tests became unsupported on aarch64 when -mcpu=unset was added to > several arm_* effective targets, because this flag is only supported > on arm. > > Since these effective targets are used on arm and aarch64, the patch > adds -mcpu=unse

[PATCH 2/2] aarch64: Improve rtx_cost for constants in COMPARE [PR120372]

2025-05-20 Thread Andrew Pinski
be handled by the cmp instruction. gcc/testsuite/ChangeLog: * gcc.target/aarch64/imm_choice_comparison-2.c: New test. Signed-off-by: Andrew Pinski --- gcc/config/aarch64/aarch64.cc | 7 ++ .../aarch64/imm_choice_comparison-2.c | 90 +++ 2 files

[PATCH 1/2] expand: Use rtx_cost directly instead of gen_move_insn for canonicalize_comparison.

2025-05-20 Thread Andrew Pinski
choice if dump is enabled. Signed-off-by: Andrew Pinski --- gcc/expmed.cc | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/gcc/expmed.cc b/gcc/expmed.cc index 72dbafe5d9f..d5da199d033 100644 --- a/gcc/expmed.cc +++ b/gcc/expmed.cc @@ -6408,18 +6408,25

[PATCH] middle-end: Fix complex lowering of cabs with no LHS [PR120369]

2025-05-20 Thread Andrew Pinski
. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/torture/pr120369-1.c | 9 + gcc/tree-complex.cc | 4 2 files changed, 13 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr120369-1.c diff --git a/gcc/testsuite/gcc.dg/torture/pr120369-1.c b/gcc

Re: [r16-372 Regression] FAIL: gfortran.dg/specifics_1.f90 -O3 -g execution test on Linux/x86_64

2025-05-18 Thread Andrew Pinski
On Sun, May 18, 2025 at 11:19 PM haochen.jiang wrote: > > On Linux/x86_64, > > 064cac730f88dc71c6da578f9ae5b8e092ab6cd4 is the first bad commit > commit 064cac730f88dc71c6da578f9ae5b8e092ab6cd4 > Author: Jan Hubicka > Date: Sun May 4 10:52:35 2025 +0200 > > Improve maybe_hot handling in inl

Re: AArch64: Enable early scheduling for -O3 and higher (PR118351)

2025-05-18 Thread Andrew Pinski
d higher. > > Is this something you may want to add to the release notes? It is there already: The first scheduling pass (-fschedule-insns) is no longer enabled by default at -O2 for AArch64 targets. The pass is still enabled by default at -O3 and -Ofast. Thanks, Andrew Pinski > > Gerald

[PATCH] gimple-fold: Implement simple copy propagation for aggregates [PR14295]

2025-05-18 Thread Andrew Pinski
. * gcc.c-torture/execute/builtins/pr22237-1-lib.c: New test. * gcc.c-torture/execute/builtins/pr22237-1.c: New test. * gcc.dg/tree-ssa/pr57361.c: Disable forwprop1. * gcc.dg/tree-ssa/pr57361-1.c: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/g++.dg/opt

[PATCH] match: Undo maybe_push_res_to_seq in some cases [PR120331]

2025-05-18 Thread Andrew Pinski
331 * gimple-match-exports.cc (maybe_undo_push): New function. (gimple_simplify): Call maybe_undo_push if resimplify was successfull. Signed-off-by: Andrew Pinski --- gcc/gimple-match-exports.cc | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --gi

[PATCH] match: Remove valueize_condition argument from gimple_extra template

2025-05-18 Thread Andrew Pinski
match-exports.o-warn): Remove. * gimple-match-exports.cc (gimple_extract): Remove valueize_condition argument. (gimple_extract_op): Update call to gimple_extract. (gimple_simplify): Likewise. Also remove valueize_condition lambda. Signed-off-by: Andrew Pinski ---

[PATCH] phiopt: Use mark_lhs_in_seq_for_dce instead of doing it inline

2025-05-17 Thread Andrew Pinski
Make non-static. * gimple-fold.h (mark_lhs_in_seq_for_dce): Declare. * tree-ssa-phiopt.cc (match_simplify_replacement): Use mark_lhs_in_seq_for_dce instead of manually looping. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc | 2 +- gcc/gimple-fold.h

Re: Proposal: File-backed allocations support for ASan reducing dependency on system memory.

2025-05-17 Thread Andrew Pinski
l non-trivial changes, functionality improvements, etc. should go through the upstream tree first and then be merged back to the GCC tree. Thanks, Andrew Pinski > > Thanks, > Archit

Re: [PATCH] gimplify: Add -Wuse-before-shadow [PR92386]

2025-05-16 Thread Andrew Pinski
On Fri, May 16, 2025 at 5:13 PM Matthew Sotoudeh wrote: > > This is a small patch to address > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92386 > > When a variable is used before being shadowed in the same scope, GCC > outputs incorrect/misleading debug information. The Bugzilla report has > a m

Re: [PATCH v2 1/2] tree-simplify: unify simple_comparison ops in vec_cond for bit and/or [PR119196]

2025-05-16 Thread Andrew Pinski
On Fri, May 16, 2025 at 9:49 AM Andrew Pinski wrote: > > On Fri, May 16, 2025 at 9:32 AM Icen Zeyada wrote: > > > > Merge simple_comparison patterns under a single vec_cond_expr for bit_and > > and bit_ior in the simplify pass. > > > > Ensure that when both

Re: [PATCH v2 1/2] tree-simplify: unify simple_comparison ops in vec_cond for bit and/or [PR119196]

2025-05-16 Thread Andrew Pinski
On Fri, May 16, 2025 at 9:32 AM Icen Zeyada wrote: > > Merge simple_comparison patterns under a single vec_cond_expr for bit_and > and bit_ior in the simplify pass. > > Ensure that when both operands of a bit-and or bit-or are simple_comparison > results, they reside within the same vec_cond_expr

Re: gcc project build error in Ubuntu18.04

2025-05-16 Thread Andrew Pinski
On Fri, May 16, 2025 at 4:10 AM Kito Cheng wrote: > > I am surprised that such generic names are defined within the system > header files, I inclined just rename that to major_version, > minor_version, could you send a patch for that? major and minor come from extracting the major/minor parts of

Re: [PATCH] match: Don't allow folling statements that can throw internally [PR119903]

2025-05-16 Thread Andrew Pinski
On Fri, May 16, 2025 at 3:13 AM Richard Biener wrote: > > On Fri, May 9, 2025 at 5:00 AM Andrew Pinski wrote: > > > > This removes the ability to follow statements that can throw internally. > > This was suggested in bug report as a way to solve the issue here. > >

Re: [PATCH v2 2/2] emit-rtl: Validate mode for paradoxical hardware subregs [PR119966]

2025-05-15 Thread Andrew Pinski
rnreg pass renaming a valid > paradoxical subreg into an invalid one. > gcc.c-torture/execute/20040709-1.c > gcc.c-torture/execute/20040709-2.c > > PR target/119966 > > gcc/ChangeLog: > > * emit-rtl.cc (validate_subreg): Validate inner > and oute

[PATCH] Forwprop: add a debug dump after propagate into comparison does something

2025-05-15 Thread Andrew Pinski
-gnu. gcc/ChangeLog: * tree-ssa-forwprop.cc (forward_propagate_into_comparison): Dump when there is a change to the statement happened. Signed-off-by: Andrew Pinski --- gcc/tree-ssa-forwprop.cc | 8 1 file changed, 8 insertions(+) diff --git a/gcc/tree-ssa-forwprop.cc b/gc

Re: [PATCH] match: Allow some optional casts for boolean comparisons

2025-05-14 Thread Andrew Pinski
On Wed, May 14, 2025 at 7:39 PM Andrew Pinski wrote: > > This is the next step in removing forward_propagate_into_comparison > and forward_propagate_into_gimple_cond; In the case of `((int)(a cmp b)) != 0` > we want to do the transformation to `a cmp b` even if the cast is used twic

[PATCH] match: Allow some optional casts for boolean comparisons

2025-05-14 Thread Andrew Pinski
. (`bool_val != false`, `bool_val == true`): Allow an optional cast between the bool_val and the ne/eq. Signed-off-by: Andrew Pinski --- gcc/match.pd | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index 79485f9678a..ffb1695e6e6 100644

Re: [PATCH] gimple: Canonical order for invariants [PR118902]

2025-05-14 Thread Andrew Pinski
On Mon, May 12, 2025 at 3:53 AM Richard Biener wrote: > > On Fri, May 9, 2025 at 10:12 PM Andrew Pinski wrote: > > > > On Mon, Apr 21, 2025 at 1:42 AM Richard Biener > > wrote: > > > > > > On Thu, Apr 17, 2025 at 7:37 PM Andrew Pinski > > >

[PATCH] tree: Canonical order for ADDR

2025-05-14 Thread Andrew Pinski
is_gimple_invariant_address ones. * match.pd (`a ptr+ b !=\== ADDR`, `ADDR !=/== ssa_name`): Move the ADDR to the last operand. Update comment. Signed-off-by: Andrew Pinski --- gcc/fold-const.cc | 6 +++--- gcc/match.pd | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git

[PATCH 1/2] forwprop: Move memcpy_to_memset from gimple fold to forwprop

2025-05-14 Thread Andrew Pinski
::execute): Try to optimize memcpy like assignment from a previous memset. gcc/testsuite/ChangeLog: * gcc.dg/pr78408-1.c: Update scan to forwprop1 only. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc | 168 - gcc/testsuite/gcc.dg/pr78408

[PATCH 2/2] forwprop: Add alias walk limit to optimize_memcpy_to_memset.

2025-05-14 Thread Andrew Pinski
As sugguested in https://gcc.gnu.org/pipermail/gcc-patches/2025-April/681507.html, this adds the aliasing walk limit. gcc/ChangeLog: * tree-ssa-forwprop.cc (optimize_memcpy_to_memset): Add a limit on the alias walk. Signed-off-by: Andrew Pinski --- gcc/tree-ssa-forwprop.cc | 4

[PATCH 3/3] gimple: Move canonicalization of bool==0 and bool!=1 to cleanupcfg

2025-05-13 Thread Andrew Pinski
_COND. * tree-cfgcleanup.h (canonicalize_bool_cond): New declaration. * tree-ssa-forwprop.cc (forward_propagate_into_gimple_cond): Call canonicalize_bool_cond. Signed-off-by: Andrew Pinski --- gcc/tree-cfgcleanup.cc | 39 +++ gcc/tree-cfgclea

[PATCH 2/3] gimple: Add assert for code being a comparison in gimple_cond_set_code

2025-05-13 Thread Andrew Pinski
being a comparison. Signed-off-by: Andrew Pinski --- gcc/gimple.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/gimple.h b/gcc/gimple.h index 977ff1c923c..94d5a13fcb2 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -3716,6 +3716,7 @@ gimple_cond_code (const gimple *gs) inline

[PATCH 1/3] forwprop: Change an if into an assert

2025-05-13 Thread Andrew Pinski
ssert that gimple_cond_code is always a comparison. Signed-off-by: Andrew Pinski --- gcc/tree-ssa-forwprop.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index fafc4d6b77a..bd407ef8a69 100644 --- a/gcc/tre

[PATCH] gimple: allow fold_stmt without setting cfun in case of GIMPLE_COND folding

2025-05-13 Thread Andrew Pinski
(replace_stmt_with_simplification): Check cfun before accessing cfun. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index 28c5069931d..b74fb8bb50c 100644 --- a/gcc

[PATCH 1/2] forwprop: Fix looping after fold_stmt and some forwprop local folds happen

2025-05-13 Thread Andrew Pinski
statement and there was a local fold that happened. gcc/ChangeLog: * tree-ssa-forwprop.cc (pass_forwprop::execute): Use `|=` for changed on the local folding. Signed-off-by: Andrew Pinski --- gcc/tree-ssa-forwprop.cc | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions

[PATCH 2/2] forwprop: Move around the marking bb for eh to after the local non-fold_stmt optimizations

2025-05-13 Thread Andrew Pinski
and marking of fixup statements to after the local optimizations. Signed-off-by: Andrew Pinski --- gcc/tree-ssa-forwprop.cc | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index bcdec1aadc3

[PATCH] verifier: Fix up PAREN_EXPR verification [PR118868]

2025-05-13 Thread Andrew Pinski
ff-by: Andrew Pinski --- gcc/testsuite/c-c++-common/pr118868-1.c | 9 + gcc/tree-cfg.cc | 12 +++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/pr118868-1.c diff --git a/gcc/testsuite/c-c++-common/pr11886

Re: [PATCH] final: Fix get_attr_length for asm goto [PR118411]

2025-05-12 Thread Andrew Pinski
On Sat, Jan 11, 2025 at 1:11 PM Jeff Law wrote: > > > > On 1/11/25 2:08 PM, Andrew Pinski (QUIC) wrote: > >> -Original Message- > >> From: Jeff Law > >> Sent: Saturday, January 11, 2025 8:12 AM > >> To: Andrew Pinski (QUIC) ; gcc- > >

[PATCH 3/3] cfgcleanup: small performance improvement in some cases

2025-05-12 Thread Andrew Pinski
the end of a basic block. (partition_stack_vars): Take a new argument, all_active. Return early if all_active is true after the qsort. (expand_used_vars): Update call to partition_stack_vars. Signed-off-by: Andrew Pinski --- gcc/cfgexpand.cc | 46

[PATCH 2/3] cfgexpand: Update cache during the original DFS walk

2025-05-12 Thread Andrew Pinski
cache if the use is already has a cache. Signed-off-by: Andrew Pinski --- gcc/cfgexpand.cc | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc index 0e76d340d26..277ef659f30 100644 --- a/gcc/cfgexpand.cc +++ b/gcc/cfgexpand.cc

[PATCH 1/3] cfgexpand: Reverse the order of going through the update_cache_list queue.

2025-05-12 Thread Andrew Pinski
and tested on x86_64-linux-gnu. gcc/ChangeLog: * cfgexpand.cc (vars_ssa_cache::operator()): Reverse the order of the going through the update list. Signed-off-by: Andrew Pinski --- gcc/cfgexpand.cc | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc

Re: [PATCH] optabs: Remove cmov optab [PR120230]

2025-05-12 Thread Andrew Pinski
On Mon, May 12, 2025 at 2:36 PM Richard Sandiford wrote: > > Andrew Pinski writes: > > cmov optab was added back in r0-24110-g1c0290eaac4094 > > (https://gcc.gnu.org/pipermail/gcc-patches/1999-September/018596.html) > > but it was never used. movcc is used instead

Re: [PATCH] optabs: Remove cmov optab [PR120230]

2025-05-12 Thread Andrew Pinski
On Mon, May 12, 2025 at 8:54 AM Andrew Pinski wrote: > > cmov optab was added back in r0-24110-g1c0290eaac4094 > (https://gcc.gnu.org/pipermail/gcc-patches/1999-September/018596.html) > but it was never used. movcc is used instead and since > r0-93453-gf90b7a5a7913cc (cond-

[PATCH] aarch64: Remove cmov6 patterns

2025-05-12 Thread Andrew Pinski
Since the cmov optab is not used and is being removed, the `cmov6` patterns from the aarch64 backend can also be removed. gcc/ChangeLog: * config/aarch64/aarch64.md (cmov6): Remove. Signed-off-by: Andrew Pinski --- gcc/config/aarch64/aarch64.md | 32 1

[PATCH v2] gimple-fold: Don't replace `tmp = FP0 CMP FP1; if (tmp != 0)` over and over again when comparison can throw

2025-05-12 Thread Andrew Pinski
/testsuite/ChangeLog: * g++.dg/tree-ssa/pr119903-1.C: New test. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc | 26 ++ gcc/testsuite/g++.dg/tree-ssa/pr119903-1.C | 24 2 files changed, 50 insertions(+) create mode 100644 gcc

Re: [PATCH] gimple-fold: Canonicalize _Bool == 0 and _Bool != 1

2025-05-12 Thread Andrew Pinski
On Mon, May 12, 2025 at 3:56 AM Richard Biener wrote: > > On Sat, May 10, 2025 at 3:13 AM Andrew Pinski > wrote: > > > > This move this canonicalization from forwprop > > (forward_propagate_into_gimple_cond) > > to gimple-fold. > > This is a step in remo

Re: [PATCH] gimple-fold: Don't replace `tmp = FP0 CMP FP1; if (tmp != 0)` over and over again when comparison can throw

2025-05-12 Thread Andrew Pinski
On Mon, May 12, 2025 at 3:51 AM Richard Biener wrote: > > On Sat, May 10, 2025 at 3:19 AM Andrew Pinski > wrote: > > > > with -ftrapping-math -fnon-call-exceptions and: > > ``` > > tmp = FP0 CMP FP1; > > > > if (tmp != 0) ... > > ``` >

[PATCH] optabs: Remove cmov optab [PR120230]

2025-05-12 Thread Andrew Pinski
. * optabs.def (cmov_optab): Remove. * optabs.h (can_compare_purpose): Remove ccp_cmov. Signed-off-by: Andrew Pinski --- gcc/optabs.cc | 3 --- gcc/optabs.def | 1 - gcc/optabs.h | 3 +-- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/gcc/optabs.cc b/gcc/optabs.cc index

Re: [PATCH 61/61] Fix pr54240

2025-05-11 Thread Andrew Pinski
mips pr54240 testcase Like r9-5152-gd1409ea5a2f759 but for the mips testcase. ``` Thanks, Andrew Pinski > > > gcc/testsuite/ > > * gcc.target/mips/pr54240.c: Scan phiopt2. > > > > Cherry-picked 02dd052d4822ca187af075f1fb5301c954844144 > > from htt

[PATCH] testsuite: Fix pr119131-1.c for targets which emit a psabi warning for vectors of DFP [PR119909]

2025-05-10 Thread Andrew Pinski
/torture/pr119131-1.c: Add -Wno-psabi. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/torture/pr119131-1.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/testsuite/gcc.dg/torture/pr119131-1.c b/gcc/testsuite/gcc.dg/torture/pr119131-1.c index c62f702f98c..1780035dade 100644 --- a/gcc

Re: [PATCH v1] libstdc++: More efficient weekday from year_month_day.

2025-05-10 Thread Andrew Pinski
On Mon, May 5, 2025, 11:48 AM Cassio Neri wrote: > Use a better algorithm to calculate n % 7, taking into account that the > divisor > is a Mersenne number. This is explained in this two-part lightning talk at > CppCon 2024 [1, 2]. > > Roughly speaking, the algorithm is used for n = sys_days but

[PATCH] aarch64: Fix narrowing warning in driver-aarch64.cc [PR118603]

2025-05-09 Thread Andrew Pinski
(aarch64_cpu_data): Add cast to unsigned to VARIANT of the define AARCH64_CORE. Signed-off-by: Andrew Pinski --- gcc/config/aarch64/driver-aarch64.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/aarch64/driver-aarch64.cc b/gcc/config/aarch64/driver-aarch64.cc index

[PATCH] aarch64: Fix narrowing warning in aarch64_detect_vector_stmt_subtype

2025-05-09 Thread Andrew Pinski
igned. Build and tested for aarch64-linux-gnu. gcc/ChangeLog: * config/aarch64/aarch64-protos.h (struct sve_vec_cost): Change gather_load_x32_cost and gather_load_x64_cost fields to unsigned. Signed-off-by: Andrew Pinski --- gcc/config/aarch64/aarch64-protos.h | 4 ++-- 1 file ch

Re: [PATCH] match: Remove (ne (cmp) 0) and (eq (cmp) 1) patterns

2025-05-09 Thread Andrew Pinski
On Fri, May 9, 2025 at 6:27 AM Richard Biener wrote: > > On Fri, May 9, 2025 at 1:34 PM Andrew Pinski wrote: > > > > On Fri, May 9, 2025 at 1:21 AM Richard Biener > > wrote: > > > > > > On Fri, May 9, 2025 at 4:51 AM Andrew Pinski > > > wrote

[PATCH] gimple-fold: Don't replace `tmp = FP0 CMP FP1; if (tmp != 0)` over and over again when comparison can throw

2025-05-09 Thread Andrew Pinski
(replace_stmt_with_simplification): Reject for noncall exceptions replacing comparison with itself. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc | 26 ++ 1 file changed, 26 insertions(+) diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index 7b3a3d30045

[PATCH] gimple-fold: Canonicalize _Bool == 0 and _Bool != 1

2025-05-09 Thread Andrew Pinski
): Canonicalize `_Bool == 0` and `_Bool != 1` into `_Bool != 0` with swapping the edges. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index

Re: [PATCH] gimple: Canonical order for invariants [PR118902]

2025-05-09 Thread Andrew Pinski
On Mon, Apr 21, 2025 at 1:42 AM Richard Biener wrote: > > On Thu, Apr 17, 2025 at 7:37 PM Andrew Pinski > wrote: > > > > So unlike constants, address invariants are currently put first if > > used with a SSA NAME. > > It would be better if address invaria

Re: [WWWDOCS] readings: add links to CTF and BTF format specifications

2025-05-09 Thread Andrew Pinski
On Fri, May 9, 2025 at 12:47 PM Indu Bhagat wrote: > > Fix PR web/114649 I think this counts as obvious. And LGTM too. > --- > htdocs/readings.html | 4 > 1 file changed, 4 insertions(+) > > diff --git a/htdocs/readings.html b/htdocs/readings.html > index 56398317..3b0556e6 100644 > --- a/

Re: [PATCH] match: Remove (ne (cmp) 0) and (eq (cmp) 1) patterns

2025-05-09 Thread Andrew Pinski
On Fri, May 9, 2025 at 4:34 AM Andrew Pinski wrote: > > On Fri, May 9, 2025 at 1:21 AM Richard Biener > wrote: > > > > On Fri, May 9, 2025 at 4:51 AM Andrew Pinski > > wrote: > > > > > > These patterns are not needed any more. There were alrea

[PATCH v2] match: Add a condition to `(ne (cmp) 0)` and `(eq (cmp) 1)` patterns for non-call exceptions

2025-05-09 Thread Andrew Pinski
bool_name != 0` into `bool_name` which will be used in the case of the non-call exceptions throwing comparisons. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * match.pd (`(ne (cmp) 0)`, `(eq (cmp) 1)`): Restrict to comparisons that don't throw. Signed-off-by: Andr

Re: [PATCH] match: Remove (ne (cmp) 0) and (eq (cmp) 1) patterns

2025-05-09 Thread Andrew Pinski
On Fri, May 9, 2025, 6:27 AM Richard Biener wrote: > On Fri, May 9, 2025 at 1:34 PM Andrew Pinski wrote: > > > > On Fri, May 9, 2025 at 1:21 AM Richard Biener > > wrote: > > > > > > On Fri, May 9, 2025 at 4:51 AM Andrew Pinski > wrote: > > &g

Re: [PATCH] match: Remove (ne (cmp) 0) and (eq (cmp) 1) patterns

2025-05-09 Thread Andrew Pinski
On Fri, May 9, 2025 at 1:21 AM Richard Biener wrote: > > On Fri, May 9, 2025 at 4:51 AM Andrew Pinski wrote: > > > > These patterns are not needed any more. There were already > > 2 patterns which did `(ne bool_var 0)` into `bool_var` and > > `(eq bool_var 1)` i

[PATCH] match: Don't allow folling statements that can throw internally [PR119903]

2025-05-08 Thread Andrew Pinski
/ChangeLog: * gimple-match-head.cc (get_def): Reject statements that can throw internally. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/pr119903-1.C: New test. Signed-off-by: Andrew Pinski --- gcc/gimple-match-head.cc | 5 - gcc/testsuite/g++.dg/tree

[PATCH] match: Remove (ne (cmp) 0) and (eq (cmp) 1) patterns

2025-05-08 Thread Andrew Pinski
-pr102671-2.c: Increase analyzer-max-svalue-depth. Signed-off-by: Andrew Pinski --- gcc/match.pd | 8 gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-2.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp24.c | 2 +- 3 files changed, 2

Re: [PATCH 2/3] gimple-fold: Return early for GIMPLE_COND with true/false

2025-05-08 Thread Andrew Pinski
On Wed, Apr 23, 2025 at 2:03 AM Richard Biener wrote: > > On Wed, Apr 23, 2025 at 5:59 AM Andrew Pinski > wrote: > > > > To speed up things slightly so not needing to call all the way through > > to match and simplify, we should return early for true/false on GIMPLE_C

[PATCH] gimple-fold: Don't replace `{true/false} != false` with `true/false` inside GIMPLE_COND

2025-05-08 Thread Andrew Pinski
ction. (gimple_cond_false_canonical_p): New function. * gimple-fold.cc (replace_stmt_with_simplification): Return false if replacing the operands of GIMPLE_COND with an INTEGER_CST and already in canonical form. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc | 15 +--

[PATCH] Fix tree-ssa/pr31261.c testcase after r16-400 [PR120168]

2025-05-08 Thread Andrew Pinski
uite/ChangeLog: * gcc.dg/tree-ssa/pr31261.c: Use `signed char` instead of plain char. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/tree-ssa/pr31261.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c b/gcc/testsuite/g

[PATCH v3 1/2] Rewrite VCEs of integral types [PR116939]

2025-05-07 Thread Andrew Pinski
. * tree-ssa-reassoc.cc: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr120122-1.c: New test. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc| 56 ++- gcc/gimple-fold.h | 6 +-- gcc/testsuite/gcc.dg/torture

[PATCH v3 2/2] phiopt: Use rewrite_to_defined_overflow in move_stmt [PR116938]

2025-05-07 Thread Andrew Pinski
/phi-opt-41.c: Likewise. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c | 7 +++--- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c | 4 ++-- gcc/tree-ssa-phiopt.cc | 26 +++--- 3 files changed, 9 insertions(+), 28 deletions(-) diff

Re: [PATCH v2 3/4] Rewrite VCEs of integral types [PR116939]

2025-05-07 Thread Andrew Pinski
On Wed, May 7, 2025 at 4:10 AM Richard Biener wrote: > > On Wed, May 7, 2025 at 3:55 AM Andrew Pinski wrote: > > > > Like the patch to phiopt (r15-4033-g1f619fe25925a5f7), this adds rewriting > > of VCE to gimple_with_undefined_signed_overflow/rewrite_to_defined_over

Re: [RFC PATCH 0/5] aarch64: Support for user-defined aarch64 tuning parameters in JSON

2025-05-06 Thread Andrew Pinski
t this interferes with the idea of having self-tests for > the JSON parser. > > Maintaing the printer/parser routines and JSON schema: > * Any change in the aarch64 tuning format will result in the need for > manual changes to be made to the routines for

[PATCH v2 2/4] gimple: Add gimple_with_undefined_signed_overflow and use it [PR111276]

2025-05-06 Thread Andrew Pinski
e-ssa-loop-split.cc (split_loop): Likewise. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc | 26 ++- gcc/gimple-fold.h| 2 +- gcc/tree-if-conv.cc | 16 +++ gcc/tree-scalar-evolution.cc | 5 + gcc/tree-ssa-ifcombine.cc

[PATCH v2 4/4] phiopt: Use rewrite_to_defined_overflow in move_stmt [PR116938]

2025-05-06 Thread Andrew Pinski
/phi-opt-41.c: Likewise. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c | 7 +++--- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c | 4 ++-- gcc/tree-ssa-phiopt.cc | 26 +++--- 3 files changed, 9 insertions(+), 28 deletions(-) diff

[PATCH v2 3/4] Rewrite VCEs of integral types [PR116939]

2025-05-06 Thread Andrew Pinski
-ifcombine.cc: Likewise. * tree-ssa-loop-im.cc: Likewise. * tree-ssa-loop-split.cc: Likewise. * tree-ssa-reassoc.cc: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr120122-1.c: New test. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc

[PATCH v2 1/4] Loop-IM: Hoist (non-expensive) stmts to executed all loop when running before PRE

2025-05-06 Thread Andrew Pinski
out of the max loops, take into account the always executed loop too. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-ssa-loop-im.cc (compute_invariantness): Hoist to the always executed point if ignorning the cost. Signed-off-by: Andrew Pinski --- gcc/tree

Re: [PATCH 2/3] x86: Add a pass to fold tail call

2025-05-06 Thread Andrew Pinski
What does musttail check do? My patch doesn't remove sibcall. > I don't see how it impacts musttail check. I think Andi is confused. This pass converts a conditional branch that has a bb that just does a tail call into a condition branch which does the tail call. E.g. ``` jne L1 ... L1: jmp func1 ``` into: ``` jne func1 ... ``` So saving one jump. tailcalls are already expanded into jumps at the point when this pass happens. It does NOT change a tail call into a non-tail call nor a non-tail call into a tail call. So it has nothing to do with musttail at all. Thanks, Andrew Pinski > > -- > H.J.

Re: [PATCH 3/4] Rewrite VCEs of integral types [PR116939]

2025-05-05 Thread Andrew Pinski
On Mon, May 5, 2025 at 12:53 PM Andrew Pinski wrote: > > On Mon, May 5, 2025 at 12:00 AM Richard Biener > wrote: > > > > On Mon, May 5, 2025 at 3:45 AM Andrew Pinski > > wrote: > > > > > > Like the patch to phiopt (r15-4033-g1f619fe25

Re: [PATCH 1/4] Loop-IM: Don't unconditional move conditional stmts during first LIM

2025-05-05 Thread Andrew Pinski
On Sun, May 4, 2025 at 11:51 PM Richard Biener wrote: > > On Mon, May 5, 2025 at 3:42 AM Andrew Pinski wrote: > > > > While fixing up how rewrite_to_defined_overflow works, > > gcc.dg/Wrestrict-22.c started > > to fail. This is because `d p+ 2` would moved by LIM

[PATCH] combine: gen_lowpart_no_emit vs CLOBBER [PR120090]

2025-05-05 Thread Andrew Pinski
g the return value. Bootstrapped and tested on x86_64-linux-gnu. PR rtl-optimization/120090 gcc/ChangeLog: * combine.cc (gen_lowpart_for_combine_no_emit): New function. (RTL_HOOKS_GEN_LOWPART_NO_EMIT): Set to gen_lowpart_for_combine_no_emit. Signed-off-by: Andrew P

Re: [PATCH 3/4] Rewrite VCEs of integral types [PR116939]

2025-05-05 Thread Andrew Pinski
On Mon, May 5, 2025 at 12:00 AM Richard Biener wrote: > > On Mon, May 5, 2025 at 3:45 AM Andrew Pinski wrote: > > > > Like the patch to phiopt (r15-4033-g1f619fe25925a5f7), this adds rewriting > > of VCE to gimple_with_undefined_signed_overflow/rewrite_to_defined_overflo

[PATCH 3/4] Rewrite VCEs of integral types [PR116939]

2025-05-04 Thread Andrew Pinski
. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc | 30 -- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index c060ef81a42..a6a7fcbb8c1 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -10602,6

[PATCH 1/4] Loop-IM: Don't unconditional move conditional stmts during first LIM

2025-05-04 Thread Andrew Pinski
better not to override the cost check for conditional executed statements in the first place. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-ssa-loop-im.cc (compute_invariantness): Don't ignore the cost for conditional executed statements. Signed-off-by: A

  1   2   3   4   5   6   7   8   9   10   >