[PUSHED] phiopt: Remove calls.h include [PR119811]

2025-04-25 Thread Andrew Pinski
: * tree-ssa-phiopt.cc: Remove calls.h include. Signed-off-by: Andrew Pinski --- gcc/tree-ssa-phiopt.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc index a194bf675e4..e27166c55a5 100644 --- a/gcc/tree-ssa-phiopt.cc +++ b/gcc/tree-ssa-phiopt.cc

[PATCH] OpenMP, GCN: Add interop-hsa testcase

2025-04-25 Thread Andrew Stubbs
a maintenance issue in future). OK for mainline and 15? Andrew libgomp/ChangeLog: * testsuite/libgomp.c/interop-hsa.c: New test. --- libgomp/testsuite/libgomp.c/interop-hsa.c | 203 ++ 1 file changed, 203 insertions(+) create mode 100644 libgomp/testsuite/libgomp.c

[PATCH] gimple-verifier: Add check that comparison in GIMPLE_COND does not throw

2025-04-24 Thread Andrew Pinski
ed on x86_64-linux-gnu. gcc/ChangeLog: * tree-cfg.cc (verify_gimple_cond): Error out if the comparison throws. Signed-off-by: Andrew Pinski --- gcc/tree-cfg.cc | 13 + 1 file changed, 13 insertions(+) diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index 6a29a5

Re: [PATCH] GCN, nvptx offloading: Host/device compatibility: Itanium C++ ABI, DSO Object Destruction API [PR119853, PR119854]

2025-04-24 Thread Andrew Stubbs
ize_t count; size_t i; The GCN part seems OK, albeit the conditionals are confusing. Andrew

Re: [PATCH] GCN: Properly switch sections in 'gcn_hsa_declare_function_name' [PR119737]

2025-04-23 Thread Andrew Stubbs
On 22/04/2025 21:41, Thomas Schwinge wrote: From: Andrew Pinski There are GCN/C++ target as well as offloading codes, where the hard-coded section names in 'gcn_hsa_declare_function_name' do not fit, and assembly thus fails: LLVM ERROR: Size expression must be absolute. T

[PATCH 3/3] gimple-fold: Don't replace `bool_var != 0` with `bool_var` inside GIMPLE_COND

2025-04-22 Thread Andrew Pinski
s can speed up things slightly because now fold_stmt won't return true on all GIMPLE_COND with `bool_var != 0` in it. gcc/ChangeLog: * gimple-fold.cc (replace_stmt_with_simplification): Return false if replacing `bool_var != 0` with `bool_var` in GIMPLE_COND. Signed-off-

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

2025-04-22 Thread Andrew Pinski
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_COND. gcc/ChangeLog: * gimple-fold.cc (fold_stmt_1): For GIMPLE_COND return early for true/false. Signed-off-by: Andrew Pinski --- gcc

[PATCH 1/3] match: Move `(cmp (cond @0 @1 @2) @3)` simplification after the bool compare simplifcation

2025-04-22 Thread Andrew Pinski
rison simplifications. Signed-off-by: Andrew Pinski --- gcc/match.pd | 31 +-- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index ba036e52837..0fe90a6edc4 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -7759,20 +7

[PATCH 0/3] A fix fixes for match and fold_stmt

2025-04-22 Thread Andrew Pinski
f the variable didn't change. There is a 4th patch which I am working on dealing with trapping math and comparisons. I am trying to figure out the best way of implementing it. Thanks, Andrew Pinski Andrew Pinski (3): match: Move `(cmp (cond @0 @1 @2) @3)` simplification after the bool

Re: [PATCH] Document AArch64 changes for GCC 15

2025-04-22 Thread Andrew Pinski
t the pre-RA scheduler is disabled at -O2? (I am not 100% sure this should be mentioned). Those are the only 2 I saw missing. Thanks, Andrew Pinski > > I'll leave a few days for comments. > > Thanks, > Richard > > --- > htdocs/gcc-15/changes.html | 241 +

Re: [PATCH 1/2] icf: Remove nop code from sem_function::init.

2025-04-22 Thread Andrew Pinski
On Tue, Apr 22, 2025 at 12:11 AM Martin Jambor wrote: > > Hi, > > On Thu, Apr 17 2025, Andrew Pinski wrote: > > Here we had: > > node = node; > > Which does nothing so let's remove it. > > > > gcc/ChangeLog: > > > > * ipa-

[PATCH] Skip g++.dg/eh/pr119507.C on arm eabi

2025-04-21 Thread Andrew Pinski
-off-by: Andrew Pinski --- gcc/testsuite/g++.dg/eh/pr119507.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/testsuite/g++.dg/eh/pr119507.C b/gcc/testsuite/g++.dg/eh/pr119507.C index 50afa75a43f..c68536ff671 100644 --- a/gcc/testsuite/g++.dg/eh/pr119507.C +++ b/gcc/testsuite/g++.dg/eh

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

2025-04-21 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: [PATCH] gimple-fold: Implement simple copy propagation for aggregates [PR14295]

2025-04-21 Thread Andrew Pinski
On Mon, Apr 21, 2025 at 9:52 AM Andrew Pinski wrote: > > This implements a simple copy propagation for aggregates in the similar > fashion as we already do for copy prop of zeroing. > > Right now this only looks at the previous vdef statement but this allows us > to catch a lot

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

2025-04-21 Thread Andrew Pinski
. * gcc.c-torture/execute/builtins/pr22237-1-lib.c: New test. * gcc.c-torture/execute/builtins/pr22237-1.c: New test. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc| 73 +++ gcc/testsuite/g++.dg/opt/pr66119.C| 2

Re: [PATCH] tailcall: Support ERF_RETURNS_ARG for tailcall [PR67797]

2025-04-19 Thread Andrew Pinski
On Sat, Apr 19, 2025 at 8:32 PM Andrew Pinski wrote: > > r15-6943-g9c4397cafc5ded added support to undo IPA-VRP return value > optimization for tail calls, > using the same code ERF_RETURNS_ARG can be supported for functions which > return one of their arguments. > This allow

[PATCH] tailcall: Support ERF_RETURNS_ARG for tailcall [PR67797]

2025-04-19 Thread Andrew Pinski
. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/67797 gcc/ChangeLog: * tree-tailcall.cc (find_tail_calls): Add support for ERF_RETURNS_ARG. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/tailcall-14.c: New test. Signed-off-by: Andrew Pinski --- gcc

[PATCH] strlen: Handle empty constructor as memset for combining with malloc to calloc [PR87900]

2025-04-19 Thread Andrew Pinski
; passing NULL_TREE for RHS. (strlen_pass::check_and_optimize_stmt): Update call to handle_assign. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/calloc-10.c: New test. * gcc.dg/tree-ssa/calloc-11.c: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/tree

[PUSHED] Fix pr118947-1.c and pr78408-3.c on targets where 32 bytes memcpy uses a vector

2025-04-19 Thread Andrew Pinski
for the memcpy and be optimized via the method that was just added. Pushed as obvious after a test run. gcc/testsuite/ChangeLog: * gcc.dg/pr118947-1.c: Use 1025 as the size of the buf. * gcc.dg/pr78408-3.c: Likewise. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/pr118947

[PATCH] Add assert to array_slice::begin/end

2025-04-19 Thread Andrew Pinski
: * vec.h (array_slice::begin): Assert that the slice is valid. (array_slice::end): Likewise. Signed-off-by: Andrew Pinski --- gcc/vec.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/vec.h b/gcc/vec.h index 915df06f03e..eae4b0feb4b 100644 --- a/gcc/vec.h

Re: [PATCH] except: Don't use the cached value of the gcc_except_table section for comdat functions [PR119507]

2025-04-18 Thread Andrew Pinski
On Fri, Mar 28, 2025 at 9:58 PM Andrew Pinski wrote: > > This has been broken since GCC started to put the comdat functions' > gcc_except_table into their > own section; r0-118218-g3e6011cfebedfb. What would happen is after a > non-comdat function is processed, > the ca

Re: [r16-22 Regression] FAIL: gcc.dg/pr78408-3.c scan-tree-dump-times forwprop1 "after previous" 1 on Linux/x86_64

2025-04-18 Thread Andrew Pinski
On Fri, Apr 18, 2025, 7:29 PM haochen.jiang wrote: > On Linux/x86_64, > > 94f275432f7ea4781ec7c05fa9d1d81ef6cb3fc1 is the first bad commit > commit 94f275432f7ea4781ec7c05fa9d1d81ef6cb3fc1 > Author: Andrew Pinski > Date: Thu Feb 20 16:09:05 2025 -0800 > >

[PATCH] strlen: Don't do the malloc+memset->calloc optimization in some cases [PR83022]

2025-04-18 Thread Andrew Pinski
loc optimization. (printf_strlen_execute): Free post dom info. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/calloc-6.c: New test. * gcc.dg/tree-ssa/calloc-7.c: New test. * gcc.dg/tree-ssa/calloc-8.c: New test. * gcc.dg/tree-ssa/calloc-9.c: New test. Signed-off-by: Andrew

Re: [PATCH 1/2] DSE: Support triming of some more memset [PR87901]

2025-04-18 Thread Andrew Pinski
On Thu, Apr 17, 2025 at 8:30 PM Sam James wrote: > > Andrew Pinski writes: > > > DSE has support for trimming memset (and memset like) statements. > > In this case we have `MEM [(char * {ref-all})&z] = {};` > > in > > the IR and when we go to trim it, we c

Re: [PATCH 2/2] DSE: Trim stores of 0 like triming stores of {} [PR87901]

2025-04-18 Thread Andrew Pinski
On Fri, Apr 18, 2025 at 6:21 AM Jeff Law wrote: > > > > On 4/17/25 9:12 PM, Andrew Pinski wrote: > > This is the second part of the PR which comes from transformation > > of memset into either stores of 0 (via an integral type) or stores > > of {}. We already ha

[PATCH 2/2] DSE: Trim stores of 0 like triming stores of {} [PR87901]

2025-04-17 Thread Andrew Pinski
: * gcc.dg/tree-ssa/ssa-dse-53.c: New test. * gcc.dg/tree-ssa/ssa-dse-54.c: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-53.c | 26 ++ gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-54.c | 25 + gcc/tree-ssa-dse.cc

[PATCH 1/2] DSE: Support triming of some more memset [PR87901]

2025-04-17 Thread Andrew Pinski
e.cc (maybe_trim_constructor_store): Strip over useless type conversions after taking the address of the MEM_REF. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/ssa-dse-52.c: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-52.c | 30 ++

[PATCH 2/2] icf: Remove unused constructors of sem_function and sem_variable

2025-04-17 Thread Andrew Pinski
iable): Likewise. * ipa-icf.h (sem_function): Remove ctor for obstack argument only one. (sem_variable): Likewise. Signed-off-by: Andrew Pinski --- gcc/ipa-icf.cc | 14 -- gcc/ipa-icf.h | 5 - 2 files changed, 19 deletions(-) diff --git a/gcc/ipa-icf.cc b/gc

[PATCH 1/2] icf: Remove nop code from sem_function::init.

2025-04-17 Thread Andrew Pinski
Here we had: node = node; Which does nothing so let's remove it. gcc/ChangeLog: * ipa-icf.cc (sem_function::init): Remove assignment of node from itself. Signed-off-by: Andrew Pinski --- gcc/ipa-icf.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/ipa-icf.cc b/gc

[PATCH] gimple-fold: Improve optimize_memcpy_to_memset by walking back until aliasing says the ref is a may clobber. [PR118947]

2025-04-17 Thread Andrew Pinski
l we get a statement that may clobber the read. gcc/testsuite/ChangeLog: * gcc.dg/pr118947-1.c: New test. Signed-off-by: Andrew Pinski --- gcc/gimple-fold.cc| 39 ++- gcc/testsuite/gcc.dg/pr118947-1.c | 15 2 files changed, 43

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

2025-04-17 Thread Andrew Pinski
8902 gcc/ChangeLog: * fold-const.cc (tree_swap_operands_p): Place invariants in the first operand if not used with constants. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr118902-1.c: New test. Signed-off-by: Andrew Pinski --- gcc/fold-const.cc

Re: [wwwdocs][Patch] gcc-15/changes: Fortran + offload (C++) update | project/gomp: GCC 15 update

2025-04-17 Thread Andrew Stubbs
On 17/04/2025 15:10, Tobias Burnus wrote: Hi all, @Fortraners: Comments to the added 'do concurrent' item? @Thomas: Are you fine with this C++ wording? @Andrew: Likewise for C++ and ROCm bump? This part is fine with me. Andrew Anyone: comments are welcome. Affected pages

Re: [PATCH] PR tree-optimization/119712 - Always reflect lower bits from mask in subranges.

2025-04-16 Thread Andrew MacLeod
On 4/16/25 16:55, Andrew MacLeod wrote: I started at a 0.2% overall compilation increase (1.8% in VRP). In the end, this patch is down to 0.6% in VRP, and only 0.08% overall, so manageable for all the extra work. Final version performance run... VRP slowed down by 0.28% Threading sped

Re: [PATCH] PR tree-optimization/119712 - Always reflect lower bits from mask in subranges.

2025-04-16 Thread Andrew MacLeod
On 4/16/25 17:28, Sam James wrote: Andrew MacLeod writes: * gcc.dg/tree-ssa/phi-opt-value-5.c  : WIth the expanded ranges, CCP2 pass use to export:    Global Exported: d_3 = [irange] int [-INF, +INF] MASK 0xfffe VALUE 0x1 and now    Global Exported: d_3 = [irange] int [-INF, -1][1

[PUSHED/12 5/6] match: Reject non-ssa name/min invariants in gimple_extract [PR116412]

2025-04-16 Thread Andrew Pinski
igned-off-by: Andrew Pinski (cherry picked from commit c7b76a076cb2c6ded7ae208464019b04cb0531a2) --- gcc/gimple-match-head.cc | 6 ++ gcc/testsuite/gcc.dg/torture/pr116412-1.c | 6 ++ 2 files changed, 12 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr116

[PUSHED/12 3/6] vec-lowering: Fix ABSU lowering [PR111285]

2025-04-16 Thread Andrew Pinski
-end/111285 gcc/ChangeLog: * tree-vect-generic.cc (do_unop): Use a signed type for the operand if the operation was ABSU_EXPR. gcc/testsuite/ChangeLog: * g++.dg/torture/vect-absu-1.C: New test. Signed-off-by: Andrew Pinski (cherry picked from commit

[PUSHED/12 0/6] Backport of regression fixes to GCC 12

2025-04-16 Thread Andrew Pinski
This includes all of the regression fixes that were backported yesterday to GCC 14 and 13 that are also regressions in GCC 12. Andrew Pinski (6): phiopt: Reset the number of iterations information of a loop when changing an exit from the loop [PR117243] backprop: Fix deleting of a phi

[PUSHED/12 6/6] testcase: Add testcase for already fixed PR [PR118476]

2025-04-16 Thread Andrew Pinski
/pr118476-1.c: New test. Signed-off-by: Andrew Pinski (cherry picked from commit d45a6502d1ec87d43f1a39f87cca58f1e28369c8) --- gcc/testsuite/gcc.dg/torture/pr118476-1.c | 14 ++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr118476-1.c diff --git a

[PUSHED/12 4/6] phiopt: Fix value_replacement for middle bb having phi nodes [PR118922]

2025-04-16 Thread Andrew Pinski
te/ChangeLog: * gcc.dg/torture/pr118922-1.c: New test. Signed-off-by: Andrew Pinski (cherry picked from commit 7232c005afb5002cdfd0a2dbd0e8b8f2d80250ce) --- gcc/testsuite/gcc.dg/torture/pr118922-1.c | 57 +++ gcc/tree-ssa-phiopt.cc| 3 ++ 2 files

[PUSHED/12 2/6] backprop: Fix deleting of a phi node [PR116922]

2025-04-16 Thread Andrew Pinski
another day. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/116922 gcc/ChangeLog: * gimple-ssa-backprop.cc (remove_unused_var): Handle phi nodes correctly. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr116922.c: New test. Signed-off-by: Andrew

[PUSHED/12 1/6] phiopt: Reset the number of iterations information of a loop when changing an exit from the loop [PR117243]

2025-04-16 Thread Andrew Pinski
o a loop. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr117243-1.c: New test. * gcc.dg/torture/pr117243-2.c: New test. Signed-off-by: Andrew Pinski (cherry picked from commit b7c69cc072ef0da36439ebc55c513b48e68391b7) --- gcc/testsuite/gcc.dg/torture/pr117243-1.c | 30

[PATCH] PR tree-optimization/119712 - Always reflect lower bits from mask in subranges.

2025-04-16 Thread Andrew MacLeod
bitmask is explicitly applied in some places and not others. Bootstraps on x86_64-pc-linux-gnu with no regressions. Finally.   Is this OK for trunk, or should I hold off a little bit? Andrew From 36e4b77565a1965d5bca15d196f32d5758393063 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Mon

Re: [PATCH] Fix wrong optimization of conditional expression with enumeration type

2025-04-16 Thread Andrew Pinski
ypes. Maybe a helper function might be useful too. Thanks, Andrew > > > 2025-04-15 Eric Botcazou > > * tree-ssa-phiopt.cc (factor_out_conditional_operation): Do not > bypass the int_fits_type_p test for boolean types whose precision > is not 1. >

Re: [PATCH] testsuite: force AMDGCN test for vect-early-break_18.c to consistent architecture [PR119286]

2025-04-16 Thread Andrew Stubbs
he compiler, so instead this updates the testcase to use one single architecture so we get a consistent result. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Cross checked the failing case on amdgcn-amdhsa and all pass now. Ok for master? This is OK. Andrew Thanks, Tamar

[PUSHED/13 2/3] match: Reject non-ssa name/min invariants in gimple_extract [PR116412]

2025-04-15 Thread Andrew Pinski
igned-off-by: Andrew Pinski (cherry picked from commit c7b76a076cb2c6ded7ae208464019b04cb0531a2) --- gcc/gimple-match-head.cc | 6 ++ gcc/testsuite/gcc.dg/torture/pr116412-1.c | 6 ++ 2 files changed, 12 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr116

[PUSHED/13 0/3] A Few more backports to GCC 13

2025-04-15 Thread Andrew Pinski
This includes the one which needed some changes to the function (gimple_extract) being split out from gimple-match-head.cc in GCC 14. Andrew Pinski (3): discriminators: Fix assigning discriminators on edge [PR113546] match: Reject non-ssa name/min invariants in gimple_extract [PR116412

[PUSHED/13 3/3] testcase: Add testcase for already fixed PR [PR118476]

2025-04-15 Thread Andrew Pinski
/pr118476-1.c: New test. Signed-off-by: Andrew Pinski (cherry picked from commit d45a6502d1ec87d43f1a39f87cca58f1e28369c8) --- gcc/testsuite/gcc.dg/torture/pr118476-1.c | 14 ++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr118476-1.c diff --git a

[PUSHED/13 1/3] discriminators: Fix assigning discriminators on edge [PR113546]

2025-04-15 Thread Andrew Pinski
gsi_start_nondebug_after_labels_bb. (assign_discriminators): Update call to first_non_label_nondebug_stmt. gcc/testsuite/ChangeLog: * c-c++-common/torture/pr113546-1.c: New test. Signed-off-by: Andrew Pinski (cherry picked from commit c5ca45b8069229b6ad9bc845f03f46340f6316d7) --- gcc/testsuite/c-c

Re: [PATCH] discriminators: Fix assigning discriminators on edge [PR113546]

2025-04-15 Thread Andrew Pinski
On Sun, Mar 16, 2025 at 11:43 AM Jeff Law wrote: > > > > On 3/15/25 9:01 PM, Andrew Pinski wrote: > > The problem here is there was a compare debug since the discriminators > > would still take into account debug statements. For the edge we would look > > at the fi

[PUSHED/14 6/6] testcase: Add testcase for already fixed PR [PR118476]

2025-04-15 Thread Andrew Pinski
/pr118476-1.c: New test. Signed-off-by: Andrew Pinski (cherry picked from commit d45a6502d1ec87d43f1a39f87cca58f1e28369c8) --- gcc/testsuite/gcc.dg/torture/pr118476-1.c | 14 ++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr118476-1.c diff --git a

[PUSHED/13 3/4] phiopt: Reset the number of iterations information of a loop when changing an exit from the loop [PR117243]

2025-04-14 Thread Andrew Pinski
o a loop. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr117243-1.c: New test. * gcc.dg/torture/pr117243-2.c: New test. Signed-off-by: Andrew Pinski (cherry picked from commit b7c69cc072ef0da36439ebc55c513b48e68391b7) (cherry picked from commit 6f0d80202b62ae48381d9ec7488522199cb7922a) ---

[PUSHED/13 4/4] phiopt: Fix value_replacement for middle bb having phi nodes [PR118922]

2025-04-14 Thread Andrew Pinski
te/ChangeLog: * gcc.dg/torture/pr118922-1.c: New test. Signed-off-by: Andrew Pinski (cherry picked from commit 7232c005afb5002cdfd0a2dbd0e8b8f2d80250ce) (cherry picked from commit 0d931663498d2f95fb7ea0ae0ef8473f88eed26a) --- gcc/testsuite/gcc.dg/torture/pr118922-1.c | 57

[PUSHED/13 0/4] Backported patches to gcc 13

2025-04-14 Thread Andrew Pinski
Just a set of 4 patches backported from the trunk via 14 branch to the GCC 13 release branch. These all fix regressions. Andrew Pinski (4): vec-lowering: Fix ABSU lowering [PR111285] backprop: Fix deleting of a phi node [PR116922] phiopt: Reset the number of iterations information of a loop

[PUSHED/13 2/4] backprop: Fix deleting of a phi node [PR116922]

2025-04-14 Thread Andrew Pinski
another day. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/116922 gcc/ChangeLog: * gimple-ssa-backprop.cc (remove_unused_var): Handle phi nodes correctly. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr116922.c: New test. Signed-off-by: Andrew

[PUSHED/13 1/4] vec-lowering: Fix ABSU lowering [PR111285]

2025-04-14 Thread Andrew Pinski
-end/111285 gcc/ChangeLog: * tree-vect-generic.cc (do_unop): Use a signed type for the operand if the operation was ABSU_EXPR. gcc/testsuite/ChangeLog: * g++.dg/torture/vect-absu-1.C: New test. Signed-off-by: Andrew Pinski (cherry picked from commit

[PUSHED/14 0/2] A few backports to GCC 14

2025-04-14 Thread Andrew Pinski
These 2 had simple resolvable conflicts when backporting. In the case of value_replacement, there was some minor code movement in value_replacement which needed to be resolved. In the case of PR117243, there was an extra include that was not on the branch. Andrew Pinski (2): phiopt: Fix

[PUSHED14 2/2] phiopt: Reset the number of iterations information of a loop when changing an exit from the loop [PR117243]

2025-04-14 Thread Andrew Pinski
o a loop. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr117243-1.c: New test. * gcc.dg/torture/pr117243-2.c: New test. Signed-off-by: Andrew Pinski (cherry picked from commit b7c69cc072ef0da36439ebc55c513b48e68391b7) --- gcc/testsuite/gcc.dg/torture/pr117243-1.c | 30

[PUSHED14 1/2] phiopt: Fix value_replacement for middle bb having phi nodes [PR118922]

2025-04-14 Thread Andrew Pinski
te/ChangeLog: * gcc.dg/torture/pr118922-1.c: New test. Signed-off-by: Andrew Pinski (cherry picked from commit 7232c005afb5002cdfd0a2dbd0e8b8f2d80250ce) --- gcc/testsuite/gcc.dg/torture/pr118922-1.c | 57 +++ gcc/tree-ssa-phiopt.cc| 4 ++ 2 files

[PUSHED/14 5/6] match: Reject non-ssa name/min invariants in gimple_extract [PR116412]

2025-04-14 Thread Andrew Pinski
tract): Return false if op0 was not a SSA name nor a min invariant for REALPART_EXPR/IMAGPART_EXPR/VCE and BIT_FIELD_REF. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr116412-1.c: New test. Signed-off-by: Andrew Pinski (cherry picked from c

[PUSHED/14 4/6] vec-lowering: Fix ABSU lowering [PR111285]

2025-04-14 Thread Andrew Pinski
-end/111285 gcc/ChangeLog: * tree-vect-generic.cc (do_unop): Use a signed type for the operand if the operation was ABSU_EXPR. gcc/testsuite/ChangeLog: * g++.dg/torture/vect-absu-1.C: New test. Signed-off-by: Andrew Pinski (cherry picked from commit

[PUSHED/14 3/6] backprop: Fix deleting of a phi node [PR116922]

2025-04-14 Thread Andrew Pinski
another day. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/116922 gcc/ChangeLog: * gimple-ssa-backprop.cc (remove_unused_var): Handle phi nodes correctly. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr116922.c: New test. Signed-off-by: Andrew

[PUSHED/14 0/6] Back port a few patches to 14

2025-04-14 Thread Andrew Pinski
Backport a few of my patches from the trunk to GCC 14 release branch. These all have been sitting on the trunk for some time now so it was time to backport them before a release. Andrew Pinski (6): phiopt: Fix VCE moving by rewriting it into cast [PR116098] aarch64: Fix early ra for -fno

[PUSHED/14 1/6] phiopt: Fix VCE moving by rewriting it into cast [PR116098]

2025-04-14 Thread Andrew Pinski
/torture/pr116098-1.C: New test. Signed-off-by: Andrew Pinski (cherry picked from commit 1f619fe25925a5f79b9c33962e7a72e1f9fa) --- .../c-c++-common/torture/pr116098-2.c | 46 +++ gcc/testsuite/g++.dg/torture/pr116098-1.C | 33 + gcc/tree-ssa-phiopt.cc

[PUSHED/14 2/6] aarch64: Fix early ra for -fno-delete-dead-exceptions [PR116927]

2025-04-14 Thread Andrew Pinski
::is_dead_insn): Insns that throw are not dead with -fno-delete-dead-exceptions. gcc/testsuite/ChangeLog: * g++.dg/torture/pr116927-1.C: New test. Signed-off-by: Andrew Pinski (cherry picked from commit edec4bfc99744b48da3ffde1e4f39c9aceecfd42) --- gcc/config/aarch64/aarch64-early

[PUSHED] testcase: Add testcase for already fixed PR [PR118476]

2025-04-14 Thread Andrew Pinski
/pr118476-1.c: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/torture/pr118476-1.c | 14 ++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr118476-1.c diff --git a/gcc/testsuite/gcc.dg/torture/pr118476-1.c b/gcc/testsuite/gcc.dg

Re: [PATCH] doc: Document lack of SAHF support on Apple Rosetta 2 [PR119781]

2025-04-13 Thread Andrew Pinski
t implement v2/v3 here either. It seems like it should be part of the Rosetta documentation that comes from Apple. Thanks, Andrew > > PR target/119781 > > gcc/ChangeLog: > > * doc/invoke.texi: Document lack of SAHF on Apple Rosetta 2. > > Signed-off-

[PATCH] testsuite: unxfail ira-shrinkwrap-prep-[12].c for x86_64 [PR117706]

2025-04-12 Thread Andrew Pinski
. PR testsuite/117706 gcc/testsuite/ChangeLog: * gcc.dg/ira-shrinkwrap-prep-1.c: Unxfail for i?68-*-* and x86_64-*-*. * gcc.dg/ira-shrinkwrap-prep-2.c: Likewise. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c | 2 +- gcc/testsuite/gcc.dg/ira

Re: [PATCH] tailc, expand: Small incremental tweak to tail call dump [PR119718]

2025-04-11 Thread Andrew Pinski
flicts slightly with this one: https://gcc.gnu.org/pipermail/gcc-patches/2025-March/679386.html Thanks, Andrew Pinski > > 2025-04-11 Jakub Jelinek > > PR tree-optimization/119718 > * tree-tailcall.cc (maybe_error_musttail): Dump the GIMPLE at the > end of

Re: .ACCESS_WITH_SIZE and pointer ranges

2025-04-11 Thread Andrew MacLeod
On 4/11/25 10:27, Qing Zhao wrote: On Apr 10, 2025, at 11:12, Martin Uecker wrote: Am Donnerstag, dem 10.04.2025 um 10:55 -0400 schrieb Siddhesh Poyarekar: On 2025-04-10 10:50, Andrew MacLeod wrote: Its not clear to me exactly what is being asked, but I think the suggestion is that

Re: .ACCESS_WITH_SIZE and pointer ranges

2025-04-11 Thread Andrew MacLeod
On 4/11/25 11:36, Qing Zhao wrote: On Apr 11, 2025, at 10:42, Andrew MacLeod wrote: On 4/11/25 10:27, Qing Zhao wrote: On Apr 10, 2025, at 11:12, Martin Uecker wrote: Am Donnerstag, dem 10.04.2025 um 10:55 -0400 schrieb Siddhesh Poyarekar: On 2025-04-10 10:50, Andrew MacLeod wrote

Re: .ACCESS_WITH_SIZE and pointer ranges

2025-04-11 Thread Andrew MacLeod
On 4/11/25 10:05, Qing Zhao wrote: On Apr 10, 2025, at 10:55, Siddhesh Poyarekar wrote: On 2025-04-10 10:50, Andrew MacLeod wrote: Its not clear to me exactly what is being asked, but I think the suggestion is that pointer references are being replaced with a builtin function called

Re: [PATCH v2] testcase: Add testcase for shrink wrapping of vector::push_back [PR118502]

2025-04-10 Thread Andrew Pinski
On Sun, Mar 9, 2025 at 1:35 PM Andrew Pinski wrote: > > LLVM folks noticed that GCC was shrink wrapping the call to > vector::push_back. > So I thought it was a good idea to commit a testcase to make sure GCC does > not regress > in this area unknowning. > > Note the

Re: .ACCESS_WITH_SIZE and pointer ranges

2025-04-10 Thread Andrew MacLeod
that could aid optimization or even diagnostics.  It's not something we do at the moment AFAIK though, except when .ACCESS_WITH_SIZE feeds directly into a __bos/__bdos call, in which case the __bos/__bdos call ends up providing that hint (I think). Andrew, is this something pranger c

[PUSHED] aarch64: Add sve testcase for PR 116595 [PR116595]

2025-04-09 Thread Andrew Pinski
.C: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/g++.target/aarch64/sve/pr116595.C | 7 +++ 1 file changed, 7 insertions(+) create mode 100644 gcc/testsuite/g++.target/aarch64/sve/pr116595.C diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr116595.C b/gcc/testsuite/g++.target

Re: GCN, nvptx libstdc++: Force use of '__atomic' builtins [PR119645]

2025-04-07 Thread Andrew Stubbs
rregardless" is not a good word. Just use "regardless" (of the outcome) or "disregarding" (the outcome). Otherwise LGTM. At least GCN certainly does support atomics, so the configure test must be broken somehow. Andrew

[PATCH v2 3/4] rust: use range for inside rust-gcc.cc [PR119341]

2025-04-05 Thread Andrew Pinski
. (function_type_variadic): Likewise. (fill_in_fields): Likewise. (statement_list): Likewise. (block): Likewise. (block_add_statements): Likewise. (function_set_parameters): Likewise. (write_global_definitions): Likewise. Signed-off-by: Andrew Pinski

Re: [PATCH] inline: Add a call to unreachable to the return block for noreturn calls [PR119599]

2025-04-05 Thread Andrew Pinski
On Wed, Apr 2, 2025 at 11:52 PM Richard Biener wrote: > > On Thu, Apr 3, 2025 at 7:10 AM Andrew Pinski wrote: > > > > builtin_unreachable_bb_p exacts empty basic blocks to have only one > > successor edge but > > in the case after inliing a noreturn function

[PATCH] vect: Add assert to expand_vector_conversion [PR118616]

2025-04-05 Thread Andrew Pinski
assert that converts vect is non empty if supportable_indirect_convert_operation returns true. Signed-off-by: Andrew Pinski --- gcc/tree-vect-generic.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc index 173ebd9a7ba..246297ec6a9

Re: [PATCH] inline: Add a call to unreachable to the return block for noreturn calls [PR119599]

2025-04-05 Thread Andrew Pinski
On Thu, Apr 3, 2025 at 12:14 AM Richard Biener wrote: > > On Thu, Apr 3, 2025 at 9:04 AM Andrew Pinski wrote: > > > > On Wed, Apr 2, 2025 at 11:52 PM Richard Biener > > wrote: > > > > > > On Thu, Apr 3, 2025 at 7:10 AM Andrew Pinski > > > wro

[PATCH] phiprop: Avoid proping loads into loops [PR116835]

2025-04-05 Thread Andrew Pinski
: * tree-ssa-phiprop.cc (propagate_with_phi): Check the use is at the same or deeper loop depth than the phi node. (pass_phiprop::execute): Initialize loops. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr116835.c: New test. Signed-off-by: Andrew Pinski

[PATCH v2 2/4] rust: Use error_operand_p in rust-gcc.cc

2025-04-05 Thread Andrew Pinski
. (write_global_definitions): Use error_operand_p. Tighten up the code around the loop. Signed-off-by: Andrew Pinski --- gcc/rust/rust-gcc.cc | 189 --- 1 file changed, 88 insertions(+), 101 deletions(-) diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust

[PATCH] Add testcase for bogus Warray-bounds warning dealing with __builtin_unreachable [PR100038]

2025-04-05 Thread Andrew Pinski
gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/pr100038.C: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/g++.dg/tree-ssa/pr100038.C | 17 + 1 file changed, 17 insertions(+) create mode 100644 gcc/testsuite/g++.dg/tree-ssa/pr100038.C diff --git a/gcc/testsuite/g++.dg

[PATCHv2 1/2] libstdc++: Add unreachable checks to begin/end [PR111499]

2025-04-05 Thread Andrew Pinski
pr111499-1.C: New test. * g++.dg/tree-ssa/pr111499.C: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/g++.dg/tree-ssa/pr111499-1.C | 16 gcc/testsuite/g++.dg/tree-ssa/pr111499.C | 15 +++ libstdc++-v3/include/bits/stl_vector.h | 48 +++---

[PATCH 2/2] libstdc++: Improve knowledge of vector size after constructor [PR110620]

2025-04-05 Thread Andrew Pinski
initialization loop. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/pr110620.C: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/g++.dg/tree-ssa/pr110620.C | 27 libstdc++-v3/include/bits/stl_vector.h | 15 + 2 files changed, 42 insertions

Re: [PATCH] libstdc++: Add unreachable checks to begin/end [PR111499]

2025-04-04 Thread Andrew Pinski
On Fri, Apr 4, 2025 at 3:37 PM Andrew Pinski wrote: > > To help along cases where begin and end are passed on to another function > and then uses std::distance on them. In the case of the testcases added, > std::lexicographical_compare_three_way (for C++20). We now able to opimi

[PATCH] libstdc++: Add unreachable checks to begin/end [PR111499]

2025-04-04 Thread Andrew Pinski
tree-ssa/pr111499.C: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/g++.dg/tree-ssa/pr111499-1.C | 16 ++ gcc/testsuite/g++.dg/tree-ssa/pr111499.C | 15 + libstdc++-v3/include/bits/stl_vector.h | 36 ++ 3 files changed, 61 insertions(+), 6 d

[PATCH] libstdc++: Add unreachable checks to begin/end [PR111499]

2025-04-04 Thread Andrew Pinski
tree-ssa/pr111499.C: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/g++.dg/tree-ssa/pr111499-1.C | 16 ++ gcc/testsuite/g++.dg/tree-ssa/pr111499.C | 15 + libstdc++-v3/include/bits/stl_vector.h | 36 ++ 3 files changed, 61 insertions(+), 6 d

Re: [PATCH 2/2] GCN: Don't emit weak undefined symbols [PR119369]

2025-04-04 Thread Andrew Stubbs
g/weak/weak-5.c @@ -3,6 +3,7 @@ /* { dg-require-alias "" } */ /* { dg-options "-fno-common" } */ /* { dg-skip-if "" { x86_64-*-mingw* } } */ +/* { dg-skip-if PR119369 { amdgcn-*-* } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1a" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1b" } } */ Given the limitations from another project, this looks like a reasonable work-around. I do wonder if there will be unintended consequences for real-world code (given that kernels are fragments of a larger program). OK for mainline. Andrew

Re: [PATCH] tailc: Use the IPA-VRP tail call hack even for pointers [PR119614]

2025-04-04 Thread Andrew MacLeod
On 4/4/25 00:57, Jakub Jelinek wrote: Hi! As the first two testcases show, even with pointers IPA-VRP can optimize return values from functions if they have singleton ranges into just the exact value, so we need to virtually undo that for tail calls similarly to integers and floats. The third

[PATCH] always turn return into __builtin_unreachable for noreturn fuctions [PR119599]

2025-04-03 Thread Andrew Pinski
return statements always into __builtin_unreachable calls. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr119599-1.c: New test. * gcc.dg/builtin-apply5.c: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/builtin-apply5.c | 23 +++ gcc

[PATCH] inline: Add a call to unreachable to the return block for noreturn calls [PR119599]

2025-04-02 Thread Andrew Pinski
suite/ChangeLog: * gcc.dg/torture/pr119599-1.c: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/torture/pr119599-1.c | 27 +++ gcc/tree-inline.cc| 15 + 2 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/g

Re: [PATCH v3] RISC-V: Fix wrong LMUL when only implict zve32f.

2025-04-01 Thread Andrew Waterman
On Mon, Mar 31, 2025 at 11:34 PM Robin Dapp wrote: > > >> Yeah...and I also don't like the magic "ceil(AVL / 2) ≤ vl ≤ VLMAX if > >> AVL < (2 * VLMAX)" rule... > > > > +1, spec has some description about this but I am not sure if I really get > > the point. > > > > From Spec: > > > > "For exampl

Re: [PATCH v2 0/4] Libsanitizer improvements

2025-04-01 Thread Andrew Pinski
a compiler module and a run-time library. The sources of the run-time library for these projects are hosted at https://github.com/llvm/llvm-project in the following directories: ``` Thanks, Andrew > > Kind regards, > Aleksandar Rakic > > >

Re: [PATCH] ranger: Improve nonnull_if_nonzero attribute [PR117023]

2025-03-31 Thread Andrew MacLeod
On 3/29/25 20:54, Jeff Law wrote: On 3/4/25 2:10 AM, Jakub Jelinek wrote: Hi! On Fri, Nov 22, 2024 at 07:25:23PM -0500, Andrew MacLeod wrote:   I will shortly be submitting , and presumable committing, this patch as part of a series to improve VRP time for 117467.. So it may be in place

[PATCH] except: Don't use the cached value of the gcc_except_table section for comdat functions [PR119507]

2025-03-28 Thread Andrew Pinski
/ChangeLog: * g++.dg/eh/pr119507.C: New test. Signed-off-by: Andrew Pinski --- gcc/except.cc | 9 - gcc/testsuite/g++.dg/eh/pr119507.C | 17 + 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/eh/pr119507.C diff -

Re: [PATCH] PR tree-optimization/119471 - If the LHS does not contain zero, neither do multiply operands.

2025-03-28 Thread Andrew MacLeod
On 3/28/25 03:19, Richard Biener wrote: On Fri, Mar 28, 2025 at 12:28 AM Andrew MacLeod wrote: This patch fixes both 119471 and the remainder of 110992. At issue is we do not recognize that if "a * b != 0" , then neither "a" nor "b" can be zero. This is

[PATCH] PR tree-optimization/119471 - If the LHS does not contain zero, neither do multiply operands.

2025-03-27 Thread Andrew MacLeod
nches.  OK for gcc13 and gcc14 branches? Andrew From 74edd2831affac005d2d5bf0170668188aa1a091 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 27 Mar 2025 13:44:00 -0400 Subject: [PATCH] If the LHS does not contain zero, neither do multiply operands. Given ~[0,0] = op1 * op2, range-ops sho

[PATCH][gcc13] PR tree-optimization/117287 - Backport new assume implementation

2025-03-27 Thread Andrew MacLeod
x-gnu with no regressions. Andrew From e39271c8c13b8fd5a49349000bfe8639c25cf470 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 27 Mar 2025 10:51:16 -0400 Subject: [PATCH 1/2] backport new assume implementation and cache. --- gcc/Makefile.in| 1 + gcc/gi

[PATCH] tailcall: Improve debug dumps

2025-03-26 Thread Andrew Pinski
. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-tailcall.cc (maybe_error_musttail): Move the print to the dump file to begining of the function. Also expand dump to include more information. Signed-off-by: Andrew Pinski --- gcc/tree-tailcall.cc | 16

Re: [PATCH] gimple: Verify that lhs of an assign is NOT a function [PR118796]

2025-03-25 Thread Andrew Pinski
On Tue, Mar 25, 2025 at 10:59 PM Richard Biener wrote: > > > > > Am 26.03.2025 um 04:47 schrieb Andrew Pinski : > > > > This adds a simple verification so that the LHS of an assignment is > > not a function decl. SRA and FRE will produce an ICE for this anyw

  1   2   3   4   5   6   7   8   9   10   >