[PATCH] Fix aarch64/109762: push_options/push_options does not work sometimes

2023-05-07 Thread Andrew Pinski via Gcc-patches
aarch64_isa_flags (and aarch64_asm_isa_flags) are both aarch64_feature_flags (uint64_t) but since r12-8000-g14814e20161d, they are saved/restored as unsigned long. This does not make a difference for LP64 targets but on ILP32 and LLP64IL32 targets, it means it does not get restored correctly.

[PATCH 1/3] PHIOPT: Add diamond bb form to factor_out_conditional_conversion

2023-05-06 Thread Andrew Pinski via Gcc-patches
So the function factor_out_conditional_conversion already supports diamond shaped bb forms, just need to be called for such a thing. harden-cond-comp.c needed to be changed as we would optimize out the conversion now and that causes the compare hardening not needing to split the block which it

[PATCH 1/3] PHIOPT: Add diamond bb form to factor_out_conditional_conversion

2023-05-06 Thread Andrew Pinski via Gcc-patches
So the function factor_out_conditional_conversion already supports diamond shaped bb forms, just need to be called for such a thing. harden-cond-comp.c needed to be changed as we would optimize out the conversion now and that causes the compare hardening not needing to split the block which it

[PATCH 2/3] PHIOPT: Loop over calling factor_out_conditional_conversion

2023-05-06 Thread Andrew Pinski via Gcc-patches
After adding diamond shaped bb support to factor_out_conditional_conversion, we can get a case where we have two conversions that needs factored out and then would have another phiopt happen. An example is: ``` static inline unsigned long long g(int t) { unsigned t1 = t; return t1; } unsigned

[PATCH 3/3] PHIOPT: factor out unary operations instead of just conversions

2023-05-06 Thread Andrew Pinski via Gcc-patches
After using factor_out_conditional_conversion with diamond bb, we should be able do use it also for all normal unary gimple and not just conversions. This allows to optimize PR 59424 for an example. This is also a start to optimize PR 64700 and a few others. OK? Bootstrapped and tested on

Re: [libgcc PATCH] Add bit reversal functions __bitrev[qhsd]i2.

2023-05-06 Thread Andrew Pinski via Gcc-patches
On Sat, May 6, 2023 at 10:26 AM Roger Sayle wrote: > > > This patch proposes adding run-time library support for bit reversal, > by adding a __bitrevsi2 function to libgcc. Thoughts/opinions? Are you going to add a builtin for these functions too? If so that is recorded as

[PATCH] Move substitute_and_fold over to use simple_dce_from_worklist

2023-05-05 Thread Andrew Pinski via Gcc-patches
While looking into a different issue, I noticed that it would take until the second forwprop pass to do some forward proping and it was because the ssa name was used more than once but the second statement was "dead" and we don't remove that until much later. So this uses simple_dce_from_worklist

[PATCH] MATCH: Add ABSU == 0 to a == 0 simplification

2023-05-04 Thread Andrew Pinski via Gcc-patches
There is already an `ABS == 0` to `a == 0` pattern, this just extends that to ABSU too. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/109722 gcc/ChangeLog: * match.pd: Extend the `ABS == 0` pattern to cover `ABSU == 0` too.

[PATCH] PHIOPT: Fix diamond case of match_simplify_replacement

2023-05-04 Thread Andrew Pinski via Gcc-patches
So it turns out I messed checking which edge was true/false for the diamond form. The edges, e0 and e1 here are edges from the merge block but the true/false edges are from the conditional block and with diamond/threeway, there is a bb inbetween on both edges. Most of the time, the check that was

[PATCH 1/2] Move copy_phi_arg_into_existing_phi to common location and use it

2023-05-03 Thread Andrew Pinski via Gcc-patches
While improving replace_phi_edge_with_variable for the diamond formed bb case, I need a way to copy phi entries from one edge to another as I am removing a forwarding bb inbetween. I was pointed out that jump threading code had copy_phi_arg_into_existing_phi which I can use. I also noticed that

[PATCHv2 2/2] PHIOPT: Improve replace_phi_edge_with_variable for diamond shapped bb

2023-05-03 Thread Andrew Pinski via Gcc-patches
While looking at differences between what minmax_replacement and match_simplify_replacement does. I noticed that they sometimes chose different edges to remove. I decided we should be able to do better and be able to remove both empty basic blocks in the case of match_simplify_replacement as that

[PATCH] PHIOPT: Improve replace_phi_edge_with_variable's dce_ssa_names slightly

2023-05-03 Thread Andrew Pinski via Gcc-patches
When I added the dce_ssa_names argument, I didn't realize bitmap was a pointer so I used the default argument value as auto_bitmap(). But instead we could just use nullptr and check if it was a nullptr before calling simple_dce_from_worklist. OK? Bootstrapped and tested on x86_64-linux-gnu with

Re: [PATCH] PHIOPT: Improve replace_phi_edge_with_variable for diamond shapped bb

2023-05-03 Thread Andrew Pinski via Gcc-patches
On Tue, May 2, 2023 at 11:36 PM Jeff Law wrote: > > > > On 5/3/23 00:27, Andrew Pinski via Gcc-patches wrote: > > On Tue, May 2, 2023 at 11:14 PM Richard Biener > > wrote: > >> > >> On Wed, May 3, 2023 at 12:04 AM Andrew Pinski wrote: > >>&g

Re: [PATCH] PHIOPT: Improve replace_phi_edge_with_variable for diamond shapped bb

2023-05-03 Thread Andrew Pinski via Gcc-patches
On Tue, May 2, 2023 at 11:14 PM Richard Biener wrote: > > On Wed, May 3, 2023 at 12:04 AM Andrew Pinski wrote: > > > > On Tue, May 2, 2023 at 5:26 AM Richard Biener via Gcc-patches > > wrote: > > > > > > On Sun, Apr 30, 2023 at 11:14 PM

[PATCH 1/2] Factor out copy_phi_args from gimple_duplicate_sese_tail and remove_forwarder_block.

2023-05-02 Thread Andrew Pinski via Gcc-patches
While improving replace_phi_edge_with_variable for the diamond formed bb case, I needed a new function, copy_phi_args and then I went to search for similar code and noticed both gimple_duplicate_sese_tail and remove_forwarder_block have the same code I need. So I decided it would be best if I

[PATCH 2/2] PHIOPT: Improve replace_phi_edge_with_variable for diamond shapped bb

2023-05-02 Thread Andrew Pinski via Gcc-patches
While looking at differences between what minmax_replacement and match_simplify_replacement does. I noticed that they sometimes chose different edges to remove. I decided we should be able to do better and be able to remove both empty basic blocks in the case of match_simplify_replacement as that

Re: [PATCH] RISC-V: fix build issue with gcc 4.9.x

2023-05-02 Thread Andrew Pinski via Gcc-patches
know why it is build-able > with newer GCC, > I guess that might be included by some other header indirectly. No libstdc++ was specifically fixed in GCC 6 to do the correct thing, see PR 60401 and PR 14608 (r6-6392-g96e19adabc80146648825). Thanks, Andrew Pinski > > > I'm fin

[PATCH] Add stats to simple_dce_from_worklist

2023-05-02 Thread Andrew Pinski via Gcc-patches
While looking to move substitute_and_fold_engine over to use simple_dce_from_worklist, I noticed that we don't record the stats of the removed stmts/phis. So this does that. OK? Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-ssa-dce.cc (simple_dce_from_worklist):

Re: [PATCH] PHIOPT: Improve replace_phi_edge_with_variable for diamond shapped bb

2023-05-02 Thread Andrew Pinski via Gcc-patches
On Tue, May 2, 2023 at 5:26 AM Richard Biener via Gcc-patches wrote: > > On Sun, Apr 30, 2023 at 11:14 PM Andrew Pinski via Gcc-patches > wrote: > > > > While looking at differences between what minmax_replacement > > and match_simplify_replacement does. I noticed th

Re: [PATCH] MATCH: Port CLRSB part of builtin_zero_pattern

2023-05-02 Thread Andrew Pinski via Gcc-patches
On Tue, May 2, 2023 at 5:24 AM Richard Biener via Gcc-patches wrote: > > On Sun, Apr 30, 2023 at 11:13 PM Andrew Pinski via Gcc-patches > wrote: > > > > This ports the clrsb builtin part of builtin_zero_pattern > > to match.pd. A simple pattern to port. > >

[COMMITTED] tree-optimization: [PR109702] MATCH: Fix a ? func(a) : N patterns

2023-05-02 Thread Andrew Pinski via Gcc-patches
I accidently messed up these patterns so the comparison against 0 and the arguments was not matching up when they need to be. I committed this as obvious after a bootstrap/test on x86_64-linux-gnu PR tree-optimization/109702 gcc/ChangeLog: * match.pd: Fix "a != 0 ? FUNC(a) :

Re: [PATCH] target: [PR109657] (a ? -1 : 0) | b could be optimized better for aarch64

2023-05-02 Thread Andrew Pinski via Gcc-patches
On Tue, May 2, 2023 at 5:23 AM Richard Sandiford via Gcc-patches wrote: > > Andrew Pinski via Gcc-patches writes: > > There is no canonical form for this case defined. So the aarch64 backend > > needs > > a pattern to match both of these forms. > > > > Th

[PATCH] PHIOPT: Update comment about what the pass now does

2023-05-01 Thread Andrew Pinski via Gcc-patches
I noticed I didn't update the comment about how the pass works after I initially added match_simplify_replacement. Anyways this updates the comment to be the current state of the pass. OK? gcc/ChangeLog: * tree-ssa-phiopt.cc: Update comment about how the transformation are

Re: [PATCH] libcpp: suppress builtin macro redefined warnings for __LINE__

2023-04-30 Thread Andrew Pinski via Gcc-patches
ress the > regressions and resubmit. >From c-c++-common/cpp/pr92296-2.c (line 40): #pragma push_macro("__LINE__") #undef __LINE__ /* { dg-warning "undefining" } */ gcc.dg/cpp/undef2.c (line 9): #undef __LINE__ /* { dg-warning "undefining \"__LINE__\"" } */ These testcases are specifically testing #undef of __LINE__ ... Should we be still warning for this case or not? Thanks, Andrew Pinski > > Thanks, > Jeff >

[PATCH] PHIOPT: Improve replace_phi_edge_with_variable for diamond shapped bb

2023-04-30 Thread Andrew Pinski via Gcc-patches
While looking at differences between what minmax_replacement and match_simplify_replacement does. I noticed that they sometimes chose different edges to remove. I decided we should be able to do better and be able to remove both empty basic blocks in the case of match_simplify_replacement as that

[PATCH] PHIOPT: small refactoring of match_simplify_replacement.

2023-04-30 Thread Andrew Pinski via Gcc-patches
When I added diamond shaped form bb to match_simplify_replacement, I copied the code to move the statement rather than factoring it out to a new function. This does the refactoring to a new function to avoid the duplicated code. It will make adding support for having two statements to move easier

[PATCH] MATCH: Port CLRSB part of builtin_zero_pattern

2023-04-30 Thread Andrew Pinski via Gcc-patches
This ports the clrsb builtin part of builtin_zero_pattern to match.pd. A simple pattern to port. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * match.pd (a != 0 ? CLRSB(a) : CST -> CLRSB(a)): New pattern. --- gcc/match.pd | 8 1

Re: libsanitizer: sync from master

2023-04-30 Thread Andrew Pinski via Gcc
On Tue, Nov 15, 2022 at 7:47 AM Martin Liška wrote: > > Hi. > > I've just pushed libsanitizer update that was tested on x86_64-linux and > ppc64le-linux systems. > Moreover, I run bootstrap on x86_64-linux and checked ABI difference with > abidiff. This broke hwasan on aarch64. See

Re: libsanitizer: sync from master

2023-04-30 Thread Andrew Pinski via Gcc-patches
On Tue, Nov 15, 2022 at 7:47 AM Martin Liška wrote: > > Hi. > > I've just pushed libsanitizer update that was tested on x86_64-linux and > ppc64le-linux systems. > Moreover, I run bootstrap on x86_64-linux and checked ABI difference with > abidiff. This broke hwasan on aarch64. See

[PATCH] target: [PR109657] (a ? -1 : 0) | b could be optimized better for aarch64

2023-04-28 Thread Andrew Pinski via Gcc-patches
There is no canonical form for this case defined. So the aarch64 backend needs a pattern to match both of these forms. The forms are: (set (reg/i:SI 0 x0) (if_then_else:SI (eq (reg:CC 66 cc) (const_int 0 [0])) (reg:SI 97) (const_int -1 [0x]))) and

[PATCH 0/2] Porting of builtin_zero_pattern to match

2023-04-28 Thread Andrew Pinski via Gcc-patches
__builtin_clrsb has not been moved yet either and I will get to that next week as well. Andrew Pinski (2): PHIOPT: Allow moving of some builtin calls MATCH: add some of what phiopt's builtin_zero_pattern did gcc/match.pd | 41 +++-- gcc/tree-ssa-phiopt.cc

[PATCH 2/2] MATCH: add some of what phiopt's builtin_zero_pattern did

2023-04-28 Thread Andrew Pinski via Gcc-patches
This adds the patterns for POPCOUNT BSWAP FFS PARITY CLZ and CTZ. For "a != 0 ? FUNC(a) : CST". CLRSB, CLRSBL, and CLRSBLL will be moved next. Note this is not enough to remove cond_removal_in_builtin_zero_pattern as we need to handle the case where there is an NOP_CONVERT inside the conditional

[PATCH 1/2] PHIOPT: Allow moving of some builtin calls

2023-04-28 Thread Andrew Pinski via Gcc-patches
While moving working on moving cond_removal_in_builtin_zero_pattern to match, I noticed that functions were not allowed to move as we reject all non-assignments. This changes to allowing a few calls which are known not to throw/trap. Right now it is restricted to ones which

Re: Hosting our gfortran MatterMost workspace

2023-04-28 Thread Andrew Pinski via Gcc
On Fri, Apr 28, 2023 at 8:32 AM Jerry D via Fortran wrote: > > Hello all and gcc overseers, > > I received a notice that the MasterMost server providers decided to drop > their free service. Unfortunate and understandable. > > I plan to contact the Open Software Lab folks at Oregon State

[PATCH] PHIOPT: Move two_value_replacement to match.pd

2023-04-27 Thread Andrew Pinski via Gcc-patches
This patch converts two_value_replacement function into a match.pd pattern. It is a direct translation with only one minor change, does not check for the {0,+-1} case as that is handled before in match.pd so there is no reason to do the extra check for it. OK? Bootstrapped and tested on

[PATCHv2] MATCH: Factor out code that for min max detection with constants

2023-04-27 Thread Andrew Pinski via Gcc-patches
This factors out some of the code from the min/max detection from match.pd into a function so it can be reused in other places. This is mainly used to detect the conversions of >= to > which causes the integer values to be changed by one. Changes since v1: * factor out the checks for INTEGER_CSTs

Re: [PATCH] GCC-13/changes: Add note about iostream usage

2023-04-26 Thread Andrew Pinski via Gcc-patches
On Wed, Apr 26, 2023 at 12:07 PM Jonathan Wakely via Gcc-patches wrote: > > On 26/04/23 09:53 -0700, Andrew Pinski wrote: > >This adds a note about iostream usage so it does not catch others > >in surpise like it has already. > > > >OK? > > Thanks, I agree we

[PATCH] GCC-13/changes: Add note about iostream usage

2023-04-26 Thread Andrew Pinski via Gcc-patches
This adds a note about iostream usage so it does not catch others in surpise like it has already. OK? --- htdocs/gcc-13/changes.html | 5 + 1 file changed, 5 insertions(+) diff --git a/htdocs/gcc-13/changes.html b/htdocs/gcc-13/changes.html index 70732ec0..7c83f7c4 100644 ---

[PATCH 1] Add alternative testcase of phi-opt-25.c that tests phiopt

2023-04-24 Thread Andrew Pinski via Gcc-patches
the testcase to make sure it does not fail on x86_64-linux-gnu. Thanks, Andrew Pinski gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/phi-opt-25a.c: New test. --- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25a.c | 89 + 1 file changed, 89 insertions(+) create mode 100644 gcc

[PATCH 2/7] PHIOPT: Rename tree_ssa_phiopt_worker to pass_phiopt::execute

2023-04-24 Thread Andrew Pinski via Gcc-patches
Now that store elimination and phiopt does not share outer code, we can move tree_ssa_phiopt_worker directly into pass_phiopt::execute and remove many declarations (prototypes) from the file. gcc/ChangeLog: * tree-ssa-phiopt.cc (two_value_replacement): Remove prototype.

[PATCH 6/7] MATCH: Factor out code that for min max detection with constants

2023-04-24 Thread Andrew Pinski via Gcc-patches
This factors out some of the code from the min/max detection from match.pd into a function so it can be reused in other places. This is mainly used to detect the conversions of >= to > which causes the integer values to be changed by one. OK? Bootstrapped and tested on x86_64-linux-gnu.

[PATCH 7/7] MATCH: Add patterns from phiopt's minmax_replacement

2023-04-24 Thread Andrew Pinski via Gcc-patches
This adds a few patterns from phiopt's minmax_replacement for (A CMP B) ? MIN/MAX : MIN/MAX . It is progress to remove minmax_replacement from phiopt. There are still some more cases dealing with constants on the edges (0/INT_MAX) to handle in match. OK? Bootstrapped and tested on

[PATCH 5/7] PHIOPT: Allow MIN/MAX to have up to 2 MIN/MAX expressions for early phiopt

2023-04-24 Thread Andrew Pinski via Gcc-patches
In the early PHIOPT mode, the original minmax_replacement, would replace a PHI node with up to 2 min/max expressions in some cases, this allows for that too. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * tree-ssa-phiopt.cc (phiopt_early_allow):

[PATCH 1/7] PHIOPT: Split out store elimination from phiopt

2023-04-24 Thread Andrew Pinski via Gcc-patches
Since the last cleanups, it made easier to see that we should split out the store elimination worker from tree_ssa_phiopt_worker function. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Remove

[PATCH 3/7] PHIOPT: Move store_elim_worker into pass_cselim::execute

2023-04-24 Thread Andrew Pinski via Gcc-patches
This simple patch moves the body of store_elim_worker direclty into pass_cselim::execute. Also removes unneeded prototypes too. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * tree-ssa-phiopt.cc (cond_store_replacement): Remove prototype.

[PATCH 0/7] Some more phiopt cleanups and double minmax to match

2023-04-24 Thread Andrew Pinski via Gcc-patches
minmax_replacement yet as there is a few missing patterns from match still. Those will be implemented in the next couple of weeks. Andrew Pinski (7): PHIOPT: Split out store elimination from phiopt PHIOPT: Rename tree_ssa_phiopt_worker to pass_phiopt::execute PHIOPT: Move store_elim_worker

[PATCH 4/7] MIN/MAX should be treated similar as comparisons for trapping

2023-04-24 Thread Andrew Pinski via Gcc-patches
While looking into moving optimizations from minmax_replacement in phiopt to match.pd, I Noticed that min/max were considered trapping even if -ffinite-math-only was being used. This changes those expressions to be similar as comparisons so that they are not considered trapping if

[PATCH 6/6] PHIOPT: Add support for diamond shaped bb to match_simplify_replacement

2023-04-22 Thread Andrew Pinski via Gcc-patches
This adds diamond shaped form of basic blocks to match_simplify_replacement. This is the patch is the start of removing/moving all of what minmax_replacement does to match.pd to reduce the code duplication. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Note

[PATCH 3/6] PHIOPT: Allow other diamond uses when do_hoist_loads is true

2023-04-22 Thread Andrew Pinski via Gcc-patches
While working on adding diamond shaped form to match-and-simplify phiopt, I Noticed that we would not reach there if do_hoist_loads was true. In the original code before the cleanups it was not obvious why but after I finished the cleanups, it was just a matter of removing a continue and that is

[PATCH 2/6] PHIOPT: Cleanup tree_ssa_phiopt_worker code

2023-04-22 Thread Andrew Pinski via Gcc-patches
This patch cleans up tree_ssa_phiopt_worker by merging common code. Making do_store_elim handled earlier. Note this does not change any overall logic of the code, just moves code around enough to be able to do this. This will make it easier to move code around even more and a few other fixes I

[PATCH 4/6] PHIOPT: Factor out some code from match_simplify_replacement

2023-04-22 Thread Andrew Pinski via Gcc-patches
This factors out the code checking if we have an empty bb or one statement that feeds into the phi so it can be used when adding diamond shaped bb form to match_simplify_replacement in the next patch. Also allows for some improvements in the next patches too. OK? Bootstrapped and tested on

[PATCH 5/6] PHIOPT: Ignore predicates for match-and-simplify phi-opt

2023-04-22 Thread Andrew Pinski via Gcc-patches
This fixes a missed optimization where early phi-opt would not work when there was predicates. The easiest fix is to change empty_bb_or_one_feeding_into_p to ignore those statements while checking for only feeding statement. Note phi-opt-23.c and phi-opt-24.c still fail as we don't handle diamond

[PATCH 0/6] Improve PHIOPT match and simplify for diamond shaped bbs

2023-04-22 Thread Andrew Pinski via Gcc-patches
-opt-23.c/phi-opt-24.c testcases. Andrew Pinski (6): PHIOPT: Move check on diamond bb to tree_ssa_phiopt_worker from minmax_replacement PHIOPT: Cleanup tree_ssa_phiopt_worker code PHIOPT: Allow other diamond uses when do_hoist_loads is true PHIOPT: Factor out some code from

[PATCH 1/6] PHIOPT: Move check on diamond bb to tree_ssa_phiopt_worker from minmax_replacement

2023-04-22 Thread Andrew Pinski via Gcc-patches
This moves the check to make sure on the diamond shaped form bbs that the the two middle bbs are only for that diamond shaped form earlier in the shared code. Also remove the redundant check for single_succ_p since that was already done before hand. The next patch will simplify the code even

[PATCH] PHIOPT: Improve readability of tree_ssa_phiopt_worker

2023-04-19 Thread Andrew Pinski via Gcc-patches
This small patch just changes around the code slightly to make it easier to understand that the cases were handling diamond shaped BB for both do_store_elim/do_hoist_loads. There is no effect on code output at all since all of the checks are the same still. Note this depends on

[PATCH] PHIOPT: Improve minmax diamond detection for phiopt1

2023-04-19 Thread Andrew Pinski via Gcc-patches
For diamond bb phi node detection, there is a check to make sure bb1 is not empty. But in the case where bb1 is empty except for a predicate, empty_block_p will still return true but the minmax code handles that case already so there is no reason to check if the basic block is empty. This patch

[PATCH] i386: Add new pattern for zero-extend cmov

2023-04-18 Thread Andrew Pinski via Gcc-patches
After a phiopt change, I got a failure of cmov9.c. The RTL IR has zero_extend on the outside of the if_then_else rather than on the side. Both ways are considered canonical as mentioned in PR 66588. This fixes the failure I got and also adds a testcase which fails before even my phiopt patch but

[PATCH] PHIOPT: Move tree_ssa_cs_elim into pass_cselim::execute.

2023-04-18 Thread Andrew Pinski via Gcc-patches
This moves around the code for tree_ssa_cs_elim slightly improving code readability and removing declarations that are no longer needed. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Remove declaration.

[PATCH 2/2] PHIOPT: add folding/simplification detail to the dump

2023-04-17 Thread Andrew Pinski via Gcc-patches
While debugging PHI-OPT with match-and-simplify, I found that adding more dumping to the debug dumps made it easier to understand what was going on rather than stepping in the debugger so this adds them. Note I used TDF_FOLDING rather than TDF_DETAILS as these debug messages can be chatty and only

[PATCH 1/2] PHIOPT: small cleanup in match_simplify_replacement

2023-04-17 Thread Andrew Pinski via Gcc-patches
We know that the statement we are moving is already have a SSA_NAME on the lhs so we don't need to check that and can also just call reset_flow_sensitive_info with the name we already got. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: *

[COMMITTED] PHIOPT: Remove gate_hoist_loads prototype

2023-04-17 Thread Andrew Pinski via Gcc-patches
gate_hoist_loads is defined before its usage so there is no reason for the declaration (prototype) to be there. Committed as obvious after a bootstrap/test on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * tree-ssa-phiopt.cc (gate_hoist_loads): Remove prototype. ---

Re: [PATCH] Abstract out calculation of max HWIs per wide int.

2023-04-17 Thread Andrew Pinski via Gcc-patches
{ return ((precision + HOST_BITS_PER_WIDE_INT - 1) / HOST_BITS_PER_WIDE_INT); } Thanks, Andrew Pinski > + > /* The type of result produced by a binary operation on types T1 and T2. > Defined purely for brevity. */ > #define WI_BINARY_RESULT(T1, T2) \ > @@ -1214,

Re: Y2038: GCC gthr-posix.h weakref symbol invoking function has impact on time values

2023-04-16 Thread Andrew Pinski via Gcc-bugs
On Sun, Apr 16, 2023 at 10:41 PM Puneet Kumar Yatnal (QUIC) via Gcc-bugs wrote: > > > ++ > From: Puneet Kumar Yatnal (QUIC) > Sent: Monday, April 17, 2023 9:26 AM > To: gcc-h...@gcc.gnu.org > Subject: Y2038: GCC gthr-posix.h wekref symbol invoking function has impact > on time values First

Re: [PATCH] aarch64: Add -mveclibabi=sleefgnu

2023-04-14 Thread Andrew Pinski via Gcc-patches
t; calls to those, significant (>2) performance gains can be observed. This is so wrong and it is better if you actually just used a header file instead. Specifically the openmp vect pragmas. Thanks, Andrew Pinski > > gcc/ChangeLog: > > * config/aarch64/aarch64.opt: Add -

Re: Fix ICEs related to VM types in C [PR106465, PR107557, PR108424, PR109450]

2023-04-11 Thread Andrew Pinski via Gcc-patches
On Tue, Apr 11, 2023 at 11:47 AM Martin Uecker via Gcc-patches wrote: > > > > Ok, here is another attempt on fixing issues with size expression. > Not all are regressions, but it does not make sense to try to split > it up. They might be regressions still from pre gimple (3.4 and before), though

Re: gcc with the new WIN32 threads fails to compile libstdc++

2023-04-10 Thread Andrew Pinski via Gcc
ded in newly built libgcc. Since you didn't show the link line it is hard to tell what is going wrong. Thanks, Andrew Pinski > > C:\msys64\ucrt64\x86_64-w64-mingw32\bin\ld.exe: > ../src/c++11/.libs/libc++11convenience.a(thread.o): > in function `__gthread_join': > D:/Eclipse/MINGW

Re: [PATCHv4] [AARCH64] Fix PR target/103100 -mstrict-align and memset on not aligned buffers

2023-04-06 Thread Andrew Pinski via Gcc-patches
On Tue, Apr 4, 2023 at 10:48 AM Richard Sandiford via Gcc-patches wrote: > > Andrew Pinski via Gcc-patches writes: > > The problem here is that aarch64_expand_setmem does not change the alignment > > for strict alignment case. > > This is version 4 of the fix, major chang

[PATCH] Fix typo in -param=vect-induction-float= attributes

2023-04-05 Thread Andrew Pinski via Gcc-patches
There was a typo in the attributes of the option -param=vect-induction-float= for IntegerRange. This fixes that typo. Committed to GCC 12 branch as obvious after a build/test. gcc/ChangeLog: PR tree-optimization/109427 * params.opt (-param=vect-induction-float=): Fix

[PATCH] Fix typo in -param=vect-induction-float= attributes

2023-04-05 Thread Andrew Pinski via Gcc-patches
There was a typo in the attributes of the option -param=vect-induction-float= for IntegerRange. This fixes that typo. Committed as obvious after a build/test. gcc/ChangeLog: PR tree-optimization/109427 * params.opt (-param=vect-induction-float=): Fix option attribute

Re: [PATCH] c++: 'typename T::X' vs 'struct T::X' lookup [PR109420]

2023-04-05 Thread Andrew Pinski via Gcc-patches
On Wed, Apr 5, 2023 at 10:32 AM Patrick Palka via Gcc-patches wrote: > > On Wed, 5 Apr 2023, Patrick Palka wrote: > > > r13-6098-g46711ff8e60d64 made make_typename_type no longer ignore > > non-types during the lookup, unless the TYPENAME_TYPE in question was > > followed by the :: scope

Re: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H (ping)

2023-04-02 Thread Andrew Pinski via Gcc-patches
On Sun, Apr 2, 2023 at 1:07 PM Jeff Law wrote: > > > > On 4/2/23 14:06, Andrew Pinski wrote: > > On Sun, Apr 2, 2023 at 12:55 PM Jeff Law via Gcc-patches > > wrote: > >> > >> > >> > >> On 3/31/23 12:44, Sam James wrote: > >>

Re: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H (ping)

2023-04-02 Thread Andrew Pinski via Gcc-patches
The JIT front-end moved to using C++11's mutex in r13-4164-g0a62889c7a155f and moved away from using pthread.h but didn't remove INCLUDE_PTHREAD_H support. I hope that help explains why it is no longer needed and how it became even unused. Thanks, Andrew Pinski > > Additionally, we're in a &

MIN/MAX and trapping math and NANs

2023-04-01 Thread Andrew Pinski via Gcc
be the same as a > b ? a : b which would not cause a trap. If we think they should not trap, then I will create a patch and test it for GCC 14. Thanks, Andrew Pinski

Re: recomputation and PR 109154

2023-03-31 Thread Andrew Pinski via Gcc-patches
++-v3/testsuite/23_containers/vector/bool/allocator/copy.cc:33:^M /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/new_allocator.h:147: note: destination object of size 8 allocated by 'operator new'^M Thanks, Andrew Pinski Thanks, Andrew Pinski > >

Re: [PATCH]middle-end Guard value_replacement and store_elim from seeing diamonds.

2023-03-30 Thread Andrew Pinski via Gcc-patches
ssues. > > Ok for master? I just noticed this changes the behavior of the store elimination pass to also act like phi-opt if bb layout was a diamond. I will be submitting a patch for GCC 14 to revert back that behavior with some refactoring I am doing to improve the readability of th

[PATCH] Fix fc-prototypes usage with C_INT64_T and non LP64 Targets.

2023-03-29 Thread Andrew Pinski via Gcc-patches
The problem here is we were outputing long_long instead of "long long". This was just an oversight and a missing check. Committed as obvious after a bootstrap/test on x86_64-linux-gnu. gcc/fortran/ChangeLog: * dump-parse-tree.cc (get_c_type_name): Fix "long_long" type name to be

Re: [pushed] wwwdocs: gcc-4.7: Adjust dwarfstd.org links

2023-03-29 Thread Andrew Pinski via Gcc-patches
On Wed, Mar 29, 2023 at 3:08 PM Gerald Pfeifer wrote: > > Business as usual - 301 Moved Permanently. Just FYI, dwarfstd is now hosted by sourceware too. So I doubt these URLs will change after this. Thanks, Andrew > > Gerald > --- > htdocs/gcc-4.7/changes.html | 8 > 1 file changed,

Re: GCC ASAN breaks glob()?

2023-03-26 Thread Andrew Pinski via Gcc
On Sun, Mar 26, 2023 at 12:01 PM Paul Smith wrote: > > OK here's something super-strange I discovered: > > Enabling -faddress=sanitize in GCC, causes the glob(3) function to > misbehave. > > I'm using GCC 11.3 / glibc 2.35 (x86_64 native). I have this simple > program: Maybe

Re: Should -ffp-contract=off the default on GCC?

2023-03-24 Thread Andrew Pinski via Gcc-patches
STDC FP_CONTRACT OFF is ignored with -ffp-contract=fast. > > This surprising behavior motivated Clang to add > -Xclang=-ffp-contract=fast-honor-pragmas > (https://discourse.llvm.org/t/fp-contract-fast-and-pragmas/58529). `#pragma STDC FP_CONTRACT OFF` is not even implemented yet in GCC. Rather we should document that :). It does not matter what clang does here really since GCC does not even implement the pragma. Thanks, Andrew Pinski > > > > -- > 宋方睿

Re: [PATCHv4] [AARCH64] Fix PR target/103100 -mstrict-align and memset on not aligned buffers

2023-03-24 Thread Andrew Pinski via Gcc-patches
On Fri, Mar 3, 2023 at 10:28 AM Andrew Pinski wrote: > > On Thu, Feb 9, 2023 at 7:54 PM Andrew Pinski via Gcc-patches > wrote: > > > > The problem here is that aarch64_expand_setmem does not change the alignment > > for strict alignment case. > > This is version

[PATCH] c: [PR84900] cast of compound literal does not cause the code to become a non-lvalue

2023-03-23 Thread Andrew Pinski via Gcc-patches
The problem here is after r0-92187-g2ec5deb5c3146c, maybe_lvalue_p would return false for compound literals which causes non_lvalue_loc not to wrap the expression with a NON_LVALUE_EXPR unlike before when it return true as it returns true for all language specific tree codes. This fixes that

Re: [PATCH] fix for __sanitizer_struct_mallinfo with mallinfo2

2023-03-20 Thread Andrew Pinski via Gcc-patches
On Sun, Mar 19, 2023 at 11:08 PM Reini Urban via Gcc-patches wrote: > > Fix sanititzers with mallinfo2 > e.g fedora already uses mallinfo2 with long v[10]; Parts of these patches should go upstream first. Thanks, Andrew > > -- > Reini Urban

Re: PROBLEM !!! __ OS: ANY LINUX __ COMPILERS: gcc & g++ __ OUTPUT: BAD!!!

2023-03-16 Thread Andrew Pinski via Gcc
On Thu, Mar 16, 2023 at 10:46 AM oszibarack korte via Gcc wrote: > > *An unsolved problem for more than a decade!* > *Dear GNU Compiler Collection development team!* > > *There is a problem with the gcc and g++ compilers for Linux operating > systems!* > *Here are 3 pieces of C and 3 pieces of

Re: Should -ffp-contract=off the default on GCC?

2023-03-16 Thread Andrew Pinski via Gcc-patches
ed more serious problems on Arm64 platforms. This summary ignores x87 and even ignores PowerPC in GCC having FMA even before clang/LLVM was around. > > our major question: > > Should GCC turn off -ffp-contract=fast by default since it's not IEEE754 > compliant and more > modern processors have the FMA instructions available by default? NO. We have this debate every few years and such. Thanks, Andrew Pinski > > Thanks. > > Qing

Re: [PATCH v2] RISC-V: Avoid calloc() poisoning on musl

2023-03-11 Thread Andrew Pinski via Gcc-patches
On Sat, Mar 11, 2023 at 12:32 PM Andrew Pinski wrote: > > On Sat, Mar 11, 2023 at 12:27 PM Sam James via Gcc-patches > wrote: > > > > This fixes errors like: > > ``` > > In file included from /usr/include/pthread.h:30, > > from > &

Re: [PATCH v2] RISC-V: Avoid calloc() poisoning on musl

2023-03-11 Thread Andrew Pinski via Gcc-patches
On Sat, Mar 11, 2023 at 12:27 PM Sam James via Gcc-patches wrote: > > This fixes errors like: > ``` > In file included from /usr/include/pthread.h:30, > from > /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr-default.h:35, >

[COMMITTED/12] Fix PR 105532: match.pd patterns calling tree_nonzero_bits with vector types

2023-03-10 Thread Andrew Pinski via Gcc-patches
Even though this PR was reported with an ubsan issue, the problem is tree_nonzero_bits is being called with an expression which is a vector type. This fixes three patterns I noticed which does that. And adds a testcase for one of the patterns. Committed after a bootstrapped and tested on

[COMMITTED/12] tree-optimization: [PR108684] ICE in verify_ssa due to simple_dce_from_worklist

2023-03-10 Thread Andrew Pinski via Gcc-patches
In simple_dce_from_worklist, we were removing an inline-asm which had a vdef. We should not be removing inline-asm which have a vdef as this code does not check to the store. This fixes that oversight. This was a latent bug exposed recently by both VRP and removal of stores to static starting to

[COMMITTED] Fix PR 108874: aarch64 code regression with shift and ands

2023-03-10 Thread Andrew Pinski via Gcc-patches
After r6-2044-g98e30e515f184b, code like "((x & 0xff00ff00U) >> 8)" would be optimized like (x >> 8) & 0xff00ffU which is normally better except on aarch64, the shift right could be combined with another operation in some cases. So we need to add a few define_splits to the aarch64 backends that

[PATCH] Fix PR 108874: aarch64 code regression with shift and ands

2023-03-09 Thread Andrew Pinski via Gcc-patches
After r6-2044-g98e30e515f184b, code like "((x & 0xff00ff00U) >> 8)" would be optimized like (x >> 8) & 0xff00ffU which is normally better except on aarch64, the shift right could be combined with another operation in some cases. So we need to add a few define_splits to the aarch64 backends that

[PATCHv2] Fix PR 108980: note without warning due to array bounds check

2023-03-09 Thread Andrew Pinski via Gcc-patches
The problem here is after r13-4748-g2a27ae32fabf85, in some cases we were calling inform without a corresponding warning. This changes the logic such that we only cause that to happen if there was a warning happened before hand. Changes since * v1: Fix formating and dump message as suggested by

Re: [PATCH v2 0/5] A small Texinfo refinement

2023-03-08 Thread Andrew Pinski via Gcc-patches
On Wed, Mar 8, 2023 at 5:09 PM Sandra Loosemore wrote: > > On 3/8/23 14:22, Arsen Arsenović wrote: > > > > Sandra Loosemore writes: > > > >> On 3/8/23 02:11, Arsen Arsenović wrote: > >>> Sandra Loosemore writes: > >>> > On 2/23/23 03:27, Arsen Arsenović via Gcc-patches wrote: > > I've

Re: [PATCH v2] RISC-V: Produce better code with complex constants [PR95632] [PR106602]

2023-03-05 Thread Andrew Pinski via Gcc-patches
On Sun, Mar 5, 2023 at 10:14 AM Jeff Law via Gcc-patches wrote: > > > > On 2/23/23 14:23, Andrew Pinski via Gcc-patches wrote: > > On Fri, Dec 9, 2022 at 10:25 AM Raphael Moreira Zinsly > > wrote: > >> > >> Changes since v1: > >> - Fi

Re: [PATCHv4] [AARCH64] Fix PR target/103100 -mstrict-align and memset on not aligned buffers

2023-03-03 Thread Andrew Pinski via Gcc-patches
On Thu, Feb 9, 2023 at 7:54 PM Andrew Pinski via Gcc-patches wrote: > > The problem here is that aarch64_expand_setmem does not change the alignment > for strict alignment case. > This is version 4 of the fix, major changes from the last version is fixing > the way store pairs ar

Re: [PATCH][stage1] Remove conditionals around free()

2023-03-01 Thread Andrew Pinski via Gcc-patches
On Wed, Mar 1, 2023 at 3:52 PM Bernhard Reutner-Fischer wrote: > > On Wed, 1 Mar 2023 14:59:44 -0800 > Andrew Pinski wrote: > > > On Wed, Mar 1, 2023 at 1:31 PM Bernhard Reutner-Fischer via Fortran > > wrote: > > > > > > Hi! > > >

[PATCH] Fix PR 108980: note without warning due to array bounds check

2023-03-01 Thread Andrew Pinski via Gcc-patches
The problem here is after r13-4748-g2a27ae32fabf85, in some cases we were calling inform without a corresponding warning. This changes the logic such that we only cause that to happen if there was a warning happened before hand. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Re: [PATCH][stage1] Remove conditionals around free()

2023-03-01 Thread Andrew Pinski via Gcc-patches
examples/gzjoin.c |3 +-- > zlib/examples/gzlog.c|6 ++ zlib is definitely imported from zlib upstream. So it might be good to check if we could import a new version and see if it still works instead. Thanks, Andrew Pinski > > coccinelle script and invocatio

Re: [PATCH] amdgcn: Enable SIMD vectorization of math functions

2023-02-28 Thread Andrew Pinski via Gcc-patches
CC 13 release cycle, I suspect we want to wait until GCC 13 branches off to apply this. Thanks, Andrew Pinski > > Thanks > > Kwok

Re: [PATCH v3 03/11] riscv: thead: Add support for the XTheadBa ISA extension

2023-02-23 Thread Andrew Pinski via Gcc-patches
nteract with doing -march=rv32gc_xtheadba_zba ? Seems like it might be better handle that case correctly. I suspect these all XThreadB* extensions have a similar problem too. Thanks, Andrew Pinski > > gcc/ChangeLog: > > * config/riscv/riscv.md: Include thead.md >

Re: [PATCH v2] RISC-V: Produce better code with complex constants [PR95632] [PR106602]

2023-02-23 Thread Andrew Pinski via Gcc-patches
On Fri, Dec 9, 2022 at 10:25 AM Raphael Moreira Zinsly wrote: > > Changes since v1: > - Fixed formatting issues. > - Added a name to the define_insn_and_split pattern. > - Set the target on the 'dg-do compile' in pr106602.c. > - Removed the rv32 restriction in

<    3   4   5   6   7   8   9   10   11   12   >