[PATCH] Fix aarch64 PR 99657: ICE with SVE types used without an error

2021-11-09 Thread apinski--- via Gcc-patches
From: Andrew Pinski This fixes fully where SVE types were being used without sve being enabled. Instead of trying to fix it such that we error out during RTL time, it is better to error out in front-ends. This expands verify_type_context to have a context of auto storage decl which is used for b

[PATCH] [Committed] Fix tree-optimization/103152: Still one more -signed1bit issue

2021-11-09 Thread apinski--- via Gcc-patches
From: Andrew Pinski When I fixed PR 102622, I accidently left behind a TYPE_PRECISION check which I had there for checking before hand. This check is not needed as the code will handle it correctly anyways. Committed as obvious after a bootstrap/test on x86_64-linux-gnu. PR tree-optimi

[PATCH] aarch64: [PR101529] Fix vector shuffle insertion expansion

2021-11-09 Thread apinski--- via Gcc-patches
From: Andrew Pinski The function aarch64_evpc_ins would reuse the target even though it might be the same register as the two inputs. Instead of checking to see if we can reuse the target, just use the original input directly. Committed as approved after bootstrapped and tested on aarch64-linux-

[PATCH] [COMMITTED] aarch64: [PR103170] Fix aarch64_simd_dup

2021-11-10 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is aarch64_simd_dup use the vw iterator rather than vwcore iterator. This causes problems for the V4SF and V2DF modes. I changed both of aarch64_simd_dup patterns to be consistent. Committed as obvious after a bootstrap/test on aarch64-linux-gnu. PR

[PATCH] tree-optimization: [PR103218] Fold ((type)(a<0)) << SIGNBITOFA into ((type)a) & signbit

2021-11-13 Thread apinski--- via Gcc-patches
From: Andrew Pinski This folds Fold ((type)(a<0)) << SIGNBITOFA into ((type)a) & signbit inside match.pd. This was already handled in fold-cost by: /* A < 0 ? : 0 is simply (A & ). */ I have not removed as we only simplify "a ? POW2 : 0" at the gimple level to "a << CST1" and fold actually do

[PATCH] [Commmitted] Move some testcases to torture from tree-ssa

2021-11-14 Thread apinski--- via Gcc-patches
From: Andrew Pinski While writing up some testcases, I noticed some newer testcases just had "dg-do compile/run" on them with dg-options of either -O1 or -O2. Since it is always better to run them over all optimization levels I put them in gcc.c-torture/compile or gcc.c-torture/execute. Committe

[PATCH] PR tree-optimization/103216: optimize some A ? (b op CST) : b into b op (A?CST:CST2)

2021-11-14 Thread apinski--- via Gcc-patches
From: Andrew Pinski For this PR, we have: if (d_5 < 0) goto ; [INV] else goto ; [INV] : v_7 = c_4 | -128; : # v_1 = PHI Which PHI-OPT will try to simplify "(d_5 < 0) ? (c_4 | -128) : c_4" which is not handled currently. This adds a few patterns which allows to try to see

[PATCH] tree-optimization: [PR103245] Improve detection of abs pattern using multiplication

2021-11-15 Thread apinski--- via Gcc-patches
From: Andrew Pinski So while working on PR 103228 (and a few others), I noticed the testcase for PR 94785 was failing. The problem is that the nop_convert moved from being inside the IOR to be outside of it. I also noticed the patch for PR 103228 was not needed to reproduce the issue either. T

[PATCH] Fix PR tree-optimization/103228 and 103228: folding of (type) X op CST where type is a nop convert

2021-11-15 Thread apinski--- via Gcc-patches
From: Andrew Pinski Currently we fold (type) X op CST into (type) (X op ((type-x) CST)) when the conversion widens but not when the conversion is a nop. For the same reason why we move the widening conversion (the possibility of removing an extra conversion), we should do the same if the conve

[PATCH] Fix tree-optimization/101941: IPA splitting out function with error attribute

2021-11-16 Thread apinski--- via Gcc-patches
From: Andrew Pinski The Linux kernel started to fail compile when the jump threader was improved (r12-2591-g2e96b5f14e4025691). This failure was due to the IPA splitting code decided now to split off the basic block which contained two functions, one of those functions included the error attribut

[PATCH] Fix PR 103288, ICE after PHI-OPT, move an assigment when still in use for another bb

2021-11-16 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem is r12-5300-gf98f373dd822b35c allows phiopt to recognize more basic blocks but missed one location where phiopt could move an assignment from the middle block to the non-middle one. This patch fixes that. OK? Bootstrapped and tested on x86_64-linux-gnu with no

[PATCH] Fix tree-optimization/103257: Missed jump threading due too early conversion of bool*A into bool?A:0

2021-11-17 Thread apinski--- via Gcc-patches
From: Andrew Pinski So like many optimizations on the gimple level, sometimes it makes sense to do the optimization early or later. In this case, creating a cond expression early causes other optimizations to be missed. So just disable it until canonicalize_math_p () is false. OK? Bootstrapp

[PATCHv2] Add a couple of A?CST1:CST2 match and simplify optimizations

2021-05-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski Instead of some of the more manual optimizations inside phi-opt, it would be good idea to do a lot of the heavy lifting inside match and simplify instead. In the process, this moves the three simple A?CST1:CST2 (where CST1 or CST2 is zero) simplifications. OK? Boostrapped and

[PATCH] Optimize x < 0 ? ~y : y to (x >> 31) ^ y in match.pd

2021-05-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski This copies the optimization that is done in phiopt for "x < 0 ? ~y : y to (x >> 31) ^ y" into match.pd. The code for phiopt is kept around until phiopt uses match.pd (which I am working towards). Note the original testcase is now optimized early on and I added a new testcase

[PATCH] Fix two testcases for ssa names which are more than 1 digit

2021-05-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski phi-opt-10.c and phi-opt-7.c both depend on currently that some ssa name versions are one digit long which is not always correct. This fixes the problem by detecting digits rather than just using '.'. Committed as obvious after a bootstrap/test. Thanks, Andrew Pinski gcc/te

[PATCHv2] Optimize x < 0 ? ~y : y to (x >> 31) ^ y in match.pd

2021-05-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski This copies the optimization that is done in phiopt for "x < 0 ? ~y : y to (x >> 31) ^ y" into match.pd. The code for phiopt is kept around until phiopt uses match.pd (which I am working towards). Note the original testcase is now optimized early on and I added a new testcase

[PATCH] Use match-and-simplify in phi-opt

2021-05-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski To simplify PHI-OPT and future improvements to it in most (but not all) cases, using match-and-simplify simplifies how much code is needed to be added. This depends on the following two patches: https://gcc.gnu.org/pipermail/gcc-patches/2021-May/571033.html https://gcc.gnu.or

[PATCH] Fix PR 95481: tail call fails with empty struct types

2021-05-30 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is we don't have an assignment type any more for zero-length structs as they were removed during gimplifcation. This adds a special case where the assignment var does not exist and the return decl is zero-length. OK? Tested on aarch64-linux-gnu with no regres

[PATCH 1/2] Use is_empty_type instead of zero-sized type.

2021-05-31 Thread apinski--- via Gcc-patches
From: Andrew Pinski Instead of only removing assignments of zero-sized types, assignments of all empty types should be removed during gimplification. This moves to use is_empty_type which will be used in other places too. OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions. Th

[PATCH 2/2] Fix PR 95481: tail call fails with empty struct types

2021-05-31 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is we don't have an assignment type any more for empty structs as they were removed during gimplifcation. This adds a special case where the assignment var does not exist and the return decl is empty typed. OK? Tested on aarch64-linux-gnu with no regressions.

[PATCH] Replace conditional_replacement with match and simplify

2021-05-31 Thread apinski--- via Gcc-patches
From: Andrew Pinski This is the first of series of patches to simplify phi-opt to use match and simplify in many cases. This simplification will more things to optimize. This is what Richard requested in https://gcc.gnu.org/pipermail/gcc-patches/2021-May/571197.html and I think it is the right

[PATCH] Improve match_simplify_replacement in phi-opt

2021-06-01 Thread apinski--- via Gcc-patches
From: Andrew Pinski This improves match_simplify_replace in phi-opt to handle the case where there is one cheap preparation statement in the middle basic block similar to xor_replacement and others. This allows to remove xor_replacement too. OK? Bootstrapped and tested on x86_64-linux-gnu with

[PATCH] Improve match_simplify_replacement in phi-opt

2021-06-02 Thread apinski--- via Gcc-patches
From: Andrew Pinski This improves match_simplify_replace in phi-opt to handle the case where there is one cheap (non-call) preparation statement in the middle basic block similar to xor_replacement and others. This allows to remove xor_replacement which it does too. OK? Bootstrapped and tested

[commited] Improve match_simplify_replacement in phi-opt

2021-06-08 Thread apinski--- via Gcc-patches
From: Andrew Pinski This improves match_simplify_replace in phi-opt to handle the case where there is one cheap (non-call) preparation statement in the middle basic block similar to xor_replacement and others. This allows to remove xor_replacement which it does too. OK? Bootstrapped and tested

[PATCH 1/2] Fix PR 100925: Limit some a?CST1:CST2 optimizations to intergal types only

2021-06-08 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is with offset (and pointer) types is we produce a negative expression when this optimization hits. It is easier to disable this optimization for all non-integeral types instead of finding an integer type which is the same precission as the type to do the nega

[PATCH 2/2] Disallow pointer and offset types on some gimple

2021-06-08 Thread apinski--- via Gcc-patches
From: Andrew Pinski While debugging PR 100925, I found that the gimple verifiers don't reject NEGATE on pointer or offset type. This patch adds the check on some unary and binary gimple which should not have operated on pointer/offset types. OK? Bootstrapped and tested on x86_64-linux-gnu with n

[PATCH] Add statistics counting to PHI-OPT

2021-06-10 Thread apinski--- via Gcc-patches
From: Andrew Pinski This should have been done before I started to work on connecting PHI-OPT to match-and-simplify to see quickly if we miss anything but it is better late than never. Anyways there was no statistics counting in PHI-OPT before so adding it is the right thing to do. OK? Bootstrap

[committed] Fix bb-slp-pr97709.c after computed goto change

2021-10-01 Thread apinski--- via Gcc-patches
From: Andrew Pinski Looks like I tested the change for bb-slp-pr97709.c on an older tree which did not have the error message so I had missed one more place where the change was needed. Anyways committed after testing to make sure the testcase passes now. gcc/testsuite/ChangeLog: * gcc

[PATCH] tree-optimization: [PR102622]: wrong code due to signed one bit integer and "a?-1:0"

2021-10-09 Thread apinski--- via Gcc-patches
From: Andrew Pinski So it turns out this is kinda of a latent bug but not really latent. In GCC 9 and 10, phi-opt would transform a?-1:0 (even for signed 1-bit integer) to -(type)a but the type is an one bit integer which means the negation is undefined. GCC 11 fixed the problem by checking for a

[PATCH] [GCC 10 branch] tree-optimization: [PR102622]: wrong code due to signed one bit integer and "a?-1:0"

2021-10-10 Thread apinski--- via Gcc-patches
From: Andrew Pinski So here is the GCC 10 branch version which fixes the wrong code. The problem is we create a negation of an one bit signed integer type which is undefined if the value was -1. This is not needed for GCC 11 branch since the case is handled differently there and has been fixed th

[PATCH 0/4] Fix PR tree-opt/102703

2021-10-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski This patch series fixes PR tree-opt/102703 by improving the code which will delete write only stores to also delete the phi node (if it was a phi node) that was used to define the write. We need to some factoring out of the code to make it easier to understand and less indenti

[PATCH 1/4] Add dump prints when execute_fixup_cfg removes a write only var store.

2021-10-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski While debugging PR 102703, I found it was hard to figure out where the store was being removed as there was no pass which was outputting why the store was removed. This adds to execute_fixup_cfg the output. Also note most of removals happen when execute_fixup_cfg is called fro

[PATCH 2/4] Remove outdated comment about execute_fixup_cfg

2021-10-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski The comment about execute_fixup_cfg not being able to run as a standalone pass is not true for a long time now. It has been a standalone pass for a while now. gcc/ChangeLog: * tree-cfg.c (execute_fixup_cfg): Remove comment about standalone pass. --- gcc/tre

[PATCH 3/4] Factor out removal of write only stores from execute_fixup_cfg

2021-10-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski To make it easier to fix PR 102703, factoring this code out to its own function makes it easier to read and less indentions too. gcc/ChangeLog: * tree-cfg.c (maybe_remove_writeonly_store): New function factored out from ... (execute_fixup_cfg): Here.

[PATCH 4/4] Improve maybe_remove_writeonly_store to do a simple DCE for defining statement

2021-10-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski Instead of putting a full blow DCE after execute_fixup_cfg, it makes sense to try to remove the defining statement for the store that is being removed. Right now we only handle PHI node statements as there needs no extra checks except for it is only used once in the store stat

[PATCH] Improve maybe_remove_writeonly_store to do a simple DCE for defining statement

2021-10-20 Thread apinski--- via Gcc-patches
From: Andrew Pinski Instead of putting a full blow DCE after execute_fixup_cfg, it makes sense to try to remove the defining statement for the store that is being removed. Using simple_dce_from_worklist makes this easier, just mark the ssa_name on the rhs side of the store (if it was one) in a bi

[PATCH] Fix PR 102908: wrongly removing null pointer loads

2021-10-24 Thread apinski--- via Gcc-patches
From: Andrew Pinski Just like PR 100382, here we have a DCE removing a null pointer load which is needed still. In this case, execute_fixup_cfg removes a store (correctly) and then removes the null load (incorrectly) due to not checking stmt_unremovable_because_of_non_call_eh_p. This patch adds t

[PATCH] target: [PR102941] Fix inline-asm flags with non-REG_P output

2021-10-26 Thread apinski--- via Gcc-patches
From: Andrew Pinski So the problem here is that arm_md_asm_adjust would just create a set directly to the output memory which is wrong. It needs to output to a temp register first and then do a move. OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions. I have no way to test on a

[PATCH] Fix tree-optimization/102216: missed optimization causing Warray-bounds

2021-10-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is tree-ssa-forwprop.c likes to produce &MEM [(void *)_4 + 152B] which is the same as _4 p+ 152 which the rest of GCC likes better. This implements this transformation back to pointer plus to improve better code generation later on. OK? Bootstrapped and test

[V2/PATCH] Fix tree-optimization/102216: missed optimization causing Warray-bounds

2021-10-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is tree-ssa-forwprop.c likes to produce &MEM [(void *)_4 + 152B] which is the same as _4 p+ 152 which the rest of GCC likes better. This implements this transformation back to pointer plus to improve better code generation later on. OK? Bootstrapped and test

[PATCH 4/5] Try inverted comparison for match_simplify in phiopt

2021-07-04 Thread apinski--- via Gcc-patches
From: Andrew Pinski Since match and simplify does not have all of the inverted comparison patterns, it make sense to just have phi-opt try to do the inversion and try match and simplify again. OK? Bootstrapped and tested on x86_64-linux-gnu. Thanks, Andrew Pinski gcc/ChangeLog: * tree

[PATCH 2/5] Fix PR 101237: Remove element_type call when used with the functions from real

2021-07-04 Thread apinski--- via Gcc-patches
From: Andrew Pinski HONOR_SIGNED_ZEROS, HONOR_SIGN_DEPENDENT_ROUNDING, and HONOR_SNANS all have an overload for taking a tree type now, so we should do that instead. OK? Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: PR middle-end/101237 * fold-const.c (negate_exp

[PATCH 1/5] Fix 101256: Wrong code due to range incorrect from PHI-OPT

2021-07-04 Thread apinski--- via Gcc-patches
From: Andrew Pinski So the problem here is that replace_phi_edge_with_variable will copy range information to a already (not newly) defined ssa name. This causes wrong code later on. This patch fixes the problem by requiring there to be statements that are to be placed before the conditional to

[PATCH 3/5] Allow match-and-simplified phiopt to run in early phiopt

2021-07-04 Thread apinski--- via Gcc-patches
From: Andrew Pinski To move a few things more to match-and-simplify from phiopt, we need to allow match_simplify_replacement to run in early phiopt. To do this we add a replacement for gimple_simplify that is explictly for phiopt. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressio

[PATCH 5/5] Port most of the A CMP 0 ? A : -A to match

2021-07-04 Thread apinski--- via Gcc-patches
From: Andrew Pinski To improve phiopt and be able to remove abs_replacement, this ports most of "A CMP 0 ? A : -A" from fold_cond_expr_with_comparison to match.pd. There is a few extra changes that are needed to remove the "A CMP 0 ? A : -A" part from fold_cond_expr_with_comparison: * Need to

[PATCH] Fix 101256: Wrong code due to range incorrect from PHI-OPT

2021-07-05 Thread apinski--- via Gcc-patches
From: Andrew Pinski So the problem here is that replace_phi_edge_with_variable will copy range information to a already (not newly) defined ssa name. This causes wrong code later on. This fixes the problem by require the new ssa name to be defined in the same bb as the conditional that is about

[PATCH 0/2] Misc PHIOPT patches

2021-07-08 Thread apinski--- via Gcc-patches
From: Andrew Pinski Just two misc improvements to simplify and match of phiopt. I decided to submit this two before I finish up the min/max movement to match.pd as that will take some time. Both showed up while looking into the movement of min/max though. Andrew Pinski (2): Improve early simpl

[PATCH 2/2] [PHIOPT/MATCH] Remove the statement to move if not used

2021-07-08 Thread apinski--- via Gcc-patches
From: Andrew Pinski Instead of waiting for DCE to remove the unused statement, and maybe optimize another conditional, it is better if we don't move the statement and have the statement removed. gcc/ChangeLog: * tree-ssa-phiopt.c (used_in_seq): New function. (match_simplify_repl

[PATCH 1/2] Improve early simplify and match for phiopt

2021-07-08 Thread apinski--- via Gcc-patches
From: Andrew Pinski Previously the idea was gimple_simplify_phiopt would call resimplify with a NULL sequence but that sometimes fails even if there was only one statement produced. The cases where it fails is when there are two simplifications happen. In the case of the min/max production, the f

[PATCH] [PHIOPT/MATCH] Remove the statement to move if not used

2021-07-09 Thread apinski--- via Gcc-patches
From: Andrew Pinski Instead of waiting for DCE to remove the unused statement, and maybe optimize another conditional, it is better if we don't move the statement and have the statement removed. OK? Bootstrapped and tested on x86_64-linux-gnu. Changes from v1: * v2: Change the order of insertat

[PATCH] move the (a-b) CMP 0 ? (a-b) : (b-a) optimization from fold_cond_expr_with_comparison to match

2021-07-10 Thread apinski--- via Gcc-patches
From: Andrew Pinski This patch moves the (a-b) CMP 0 ? (a-b) : (b-a) optimization from fold_cond_expr_with_comparison to match. OK? Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * match.pd ((A-B) CMP 0 ? (A-B) : (B - A)): New patterns. gcc/testsuite/ChangeLog:

[PATCH] Fix PR 101453: ICE with optimize and large integer constant

2021-07-15 Thread apinski--- via Gcc-patches
From: Andrew Pinski Every base 10 digit will take use ~3.32 bits to represent. So for a 64bit signed integer, it is 20 characters. The buffer was only 20 so it did not fit; add in the null character and "-O" part, the buffer would be 3 bytes too small. Instead of just increasing the size of the

[PATCH] Fix PR 101453: ICE with optimize and large integer constant

2021-07-16 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem is the buffer is too small to hold "-O" and the interger. This fixes the problem by use the correct size instead. Changes since v1: * v2: Use HOST_BITS_PER_LONG and just divide by 3 instead of 3.32. OK? Bootstrapped and tested on x86_64-linux with no regressions

[PATCH] [AARCH64] Fix PR 101205: csinv does not have an zero_extend version

2021-07-17 Thread apinski--- via Gcc-patches
From: Andrew Pinski So the problem is even though there was a csneg with a zero_extend in the front, there was not one for csinv. This fixes it by extending that pattern. OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions. gcc/ChangeLog: PR target/101205 * con

[PATCH] [AARCH64] Fix PR 101205: csinv does not have an zero_extend version

2021-07-17 Thread apinski--- via Gcc-patches
From: Andrew Pinski So the problem is even though there was a csneg with a zero_extend in the front, there was not one for csinv. This fixes it by extending that pattern. OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions. gcc/ChangeLog: PR target/101205 * con

[PATCH] Fix PR 10153: tail recusion for vector types.

2021-07-20 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is we try to an initialized value from a scalar constant. For vectors we need to do a vect_dup instead. This fixes that issue and we get the correct code even and it does not crash. OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions. gcc/C

[PATCH] Fix PR 10153: tail recusion for vector types.

2021-07-21 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is we try to an initialized value from a scalar constant. For vectors we need to do a vect_dup instead. This fixes that issue by using build_{one,zero}_cst instead of integer_{one,zero}_node when calling create_tailcall_accumulator. Changes from v1: * v2: Us

[PATCH] Fix x86/56337 : 1<<28 alignment is broken

2021-07-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is the x86_64 back-end uses a signed integer for alignment and then divides by BITS_PER_UNIT so if we had INT_MIN (which is what 1<<28*8 is), we would get the wrong result. This fixes the problem by using unsigned for the argument to x86_output_aligned_bss an

[PATCH] Add testcases that got lost when tree-ssa was merged

2021-07-29 Thread apinski--- via Gcc-patches
From: Andrew Pinski So I was looking at some older PRs (PR 16016 in this case), I noticed that some of the testcases were removed when the tree-ssa branch was merged. This adds them back in. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski gcc/testsuit

[PATCH] Fix PR 101683: FP exceptions for float->unsigned

2021-07-30 Thread apinski--- via Gcc-patches
From: Andrew Pinski Just like the old bug PR9651, unsigned_fix rtl should also be handled as a trapping instruction. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR rtl-optimization/101683 * rtlanal.c (may_trap_p_1): Handle UNSIGNED_FIX. -

[PATCH] Don't simplify (A & C) != 0 ? D : 0 for pointer types.

2021-05-16 Thread apinski--- via Gcc-patches
From: Andrew Pinski While rewriting part of PHI-OPT to use match-and-simplify, I ran into a bug where this pattern in match.pd would hit and would produce invalid gimple; a shift of a pointer type. This just disables this simplification for pointer types similarly to what is already done in PHI-

[PATCH] Add a couple of A?CST1:CST2 match and simplify optimizations

2021-05-16 Thread apinski--- via Gcc-patches
From: Andrew Pinski Instead of some of the more manual optimizations inside phi-opt, it would be good idea to do a lot of the heavy lifting inside match and simplify instead. In the process, this moves the three simple A?CST1:CST2 (where CST1 or CST2 is zero) simplifications. OK? Boostrapped and

[PATCH] Use toplevel configure for GMP and MPFR for gdb

2022-11-08 Thread apinski--- via Gcc-patches
From: Andrew Pinski This patch uses the toplevel configure parts for GMP/MPFR for gdb. The only thing is that gdb now requires MPFR for building. Before it was a recommended but not required library. Also this allows building of GMP and MPFR with the toplevel directory just like how it is done fo

[PATCH] Remove SLOW_SHORT_ACCESS from target headers

2022-11-09 Thread apinski--- via Gcc-patches
From: Andrew Pinski SLOW_SHORT_ACCESS is defined in bfin and i386 target headers but the target macro is not used elsewhere. So let's remove it from those two headers and posion it. OK? Built x86_64-linux-gnu and bfin-elf. gcc/ChangeLog: * config/bfin/bfin.h (SLOW_SHORT_ACCESS): Delete

[PATCHv2] Use toplevel configure for GMP and MPFR for gdb

2022-11-10 Thread apinski--- via Gcc-patches
From: Andrew Pinski This patch uses the toplevel configure parts for GMP/MPFR for gdb. The only thing is that gdb now requires MPFR for building. Before it was a recommended but not required library. Also this allows building of GMP and MPFR with the toplevel directory just like how it is done fo

[COMMITTED] Fix some @opindex with - in the front

2022-11-14 Thread apinski--- via Gcc-patches
From: Andrew Pinski I noticed this during the conversion of the docs to sphinx that some options in the option index had a - in the front of it for the texinfo docs. When the sphinx conversion was reverted, I thought I would fix the texinfo documentation for these options. Committed as obvious a

[COMMITTED] Fix @opindex for m80387

2022-11-14 Thread apinski--- via Gcc-patches
From: Andrew Pinski I noticed that the opindex for -m80387 option was wrong. It was just 80387 which was not consistent with the rest of the options. This fixes that and uses "@opindex m80387". Committed as obvious after "make html" and checking the option index page. gcc/ChangeLog: *

[PATCH] Fix @opindex for mcall-aixdesc and mcall-openbsd

2022-11-14 Thread apinski--- via Gcc-patches
From: Andrew Pinski For mcall-aixdesc, the opindex was just m which was wrong. For mcall-openbsd, the opindex was mcall-netbsd which was wrong. This two have been broken since the options were added to the documentation back in r0-92913-g244609a618b094 . Committed as obvious after a "make html"

[PATCH] Remove documentation for MeP

2022-11-14 Thread apinski--- via Gcc-patches
From: Andrew Pinski MeP support was removed in r7-1614-g0609abdad81e26 but it looks like the documentation for the target was missed. Committed as obvious after doing "make html" to make sure the documentation is fine. Thanks, Andrew Pinski gcc/ChangeLog: * doc/extend.texi: Remove MeP

[PATCH] Remove the picoChip documentation

2022-11-14 Thread apinski--- via Gcc-patches
From: Andrew Pinski PicoChip support was removed in r5-3431-g157e859ffe3b5d but the documentation was missed it seems. Committed as obvious after running "make html" to make sure the building of the documentation still works. Thanks, Andrew Pinski gcc/ChangeLog: * doc/extend.texi: Rem

[PATCH] Remove Score documentation

2022-11-14 Thread apinski--- via Gcc-patches
From: Andrew Pinski Score target support was removed in r5-3909-g3daa7bbf791203 but it looks like some of the documentation was missed. This removes it. Committed as obvious after a "make html". Thanks, Andrew gcc/ChangeLog: * doc/invoke.texi: Remove Score option section. --- gcc/doc

[COMMITTED] Fix PR 107734: valgrind errors with sbitmap in match.pd

2022-11-17 Thread apinski--- via Gcc-patches
From: Andrew Pinski sbitmap is a simple bitmap and the memory allocated is not cleared on creation; you have to clear it or set it to all ones before using it. This is unlike bitmap which is a sparse bitmap and the entries are cleared as created. The code added in r13-4044-gdc95e1e9702f2f missed

[PATCH 2/2] Fix PR middle-end/107705: ICE after reclaration error

2022-11-17 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is after we created a call expression in the C front-end, we replace the decl type with an error mark node. We then end up calling aggregate_value_p with the call expression with the decl with the error mark as the type and we ICE. The fix is to check the fun

[PATCH 1/2] Fix PRs 106764, 106765, and 107307, all ICE after invalid re-declaration

2022-11-17 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is the gimplifier returns GS_ERROR but in some cases we don't check that soon enough and try to do other work which could crash. So the fix in these two cases is to return GS_ERROR early if the gimplify_* functions had return GS_ERROR. OK? Bootstrapped and te

[PATCH 1/7] Reset the range info on the moved instruction in PHIOPT

2021-06-19 Thread apinski--- via Gcc-patches
From: Andrew Pinski I had missed this when wrote the patch which allowed the gimple to be moved from inside the conditional as it. It was also missed in the review. Anyways the range information needs to be reset for the moved gimple as it was under a conditional and the flow has changed to be

[PATCH 2/7] Duplicate the range information of the phi onto the new ssa_name

2021-06-19 Thread apinski--- via Gcc-patches
From: Andrew Pinski Since match_simplify_replacement uses gimple_simplify, there is a new ssa name created sometimes and then we go and replace the phi edge with this new ssa name, the range information on the phi is lost. I don't have a testcase right now where we lose the range information thou

[PATCH 3/7] Try inverted comparison for match_simplify in phiopt

2021-06-19 Thread apinski--- via Gcc-patches
From: Andrew Pinski Since match and simplify does not have all of the inverted comparison patterns, it make sense to just have phi-opt try to do the inversion and try match and simplify again. OK? Bootstrapped and tested on x86_64-linux-gnu. Thanks, Andrew Pinski gcc/ChangeLog: * tree

[PATCH 4/7] Expand the comparison argument of fold_cond_expr_with_comparison

2021-06-19 Thread apinski--- via Gcc-patches
From: Andrew Pinski To make things slightly easiler to convert fold_cond_expr_with_comparison over to match.pd, expanding the arg0 argument into 3 different arguments is done. Also this was simple because we don't use arg0 after grabbing the code and the two operands. Also since we do this, we do

[PATCH 6/7] Lower for loops before lowering cond in genmatch

2021-06-19 Thread apinski--- via Gcc-patches
From: Andrew Pinski While converting some fold_cond_expr_with_comparison to match, I found that I wanted to use "for cnd (cond vec_cond)" but that was not causing the lowering of cond to happen. What was happening was the lowering of the for loop was happening after the lowering of the cond. So s

[PATCH 5/7] Allow match-and-simplified phiopt to run in early phiopt

2021-06-19 Thread apinski--- via Gcc-patches
From: Andrew Pinski To move a few things more to match-and-simplify from phiopt, we need to allow match_simplify_replacement to run in early phiopt. To do this, we need to mark some match patterns if they can be done in early phiopt or not. OK? Bootstrapped and tested on x86_64-linux-gnu with n

[PATCH 7/7] Port most of the A CMP 0 ? A : -A to match

2021-06-19 Thread apinski--- via Gcc-patches
From: Andrew Pinski To improve phiopt and be able to remove abs_replacement, this ports most of "A CMP 0 ? A : -A" from fold_cond_expr_with_comparison to match.pd. There is a few extra changes that are needed to remove the "A CMP 0 ? A : -A" part from fold_cond_expr_with_comparison: * Need to

[PATCH 0/7] PHI-OPT move abs_replacement to match.pd

2021-06-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski To able to move PHI-OPT's abs_replacement to match.pd, a bunch of support needed to be added to PHI-OPT. This is a set of 7 patches which allows us to remove abs_replacement and even does one set further and does a few extra transformations that abs_replacement did not do (jus

[PATCH 2/7] Reset the range info on the moved instruction in PHIOPT

2021-06-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski I had missed this when wrote the patch which allowed the gimple to be moved from inside the conditional as it. It was also missed in the review. Anyways the range information needs to be reset for the moved gimple as it was under a conditional and the flow has changed to be

[PATCH 1/7] Expand the comparison argument of fold_cond_expr_with_comparison

2021-06-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski To make things slightly easiler to convert fold_cond_expr_with_comparison over to match.pd, expanding the arg0 argument into 3 different arguments is done. Also this was simple because we don't use arg0 after grabbing the code and the two operands. Also since we do this, we do

[PATCH 3/7] Duplicate the range information of the phi onto the new ssa_name

2021-06-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski Since match_simplify_replacement uses gimple_simplify, there is a new ssa name created sometimes and then we go and replace the phi edge with this new ssa name, the range information on the phi is lost. Placing this in replace_phi_edge_with_variable is the best option instead

[PATCH 5/7] Try inverted comparison for match_simplify in phiopt

2021-06-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski Since match and simplify does not have all of the inverted comparison patterns, it make sense to just have phi-opt try to do the inversion and try match and simplify again. OK? Bootstrapped and tested on x86_64-linux-gnu. Thanks, Andrew Pinski gcc/ChangeLog: * tree

[PATCH 4/7] Allow match-and-simplified phiopt to run in early phiopt

2021-06-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski To move a few things more to match-and-simplify from phiopt, we need to allow match_simplify_replacement to run in early phiopt. To do this we add a replacement for gimple_simplify that is explictly for phiopt. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressio

[PATCH 6/7] Lower for loops before lowering cond in genmatch

2021-06-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski While converting some fold_cond_expr_with_comparison to match, I found that I wanted to use "for cnd (cond vec_cond)" but that was not causing the lowering of cond to happen. What was happening was the lowering of the for loop was happening after the lowering of the cond. So s

[PATCH 7/7] Port most of the A CMP 0 ? A : -A to match

2021-06-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski To improve phiopt and be able to remove abs_replacement, this ports most of "A CMP 0 ? A : -A" from fold_cond_expr_with_comparison to match.pd. There is a few extra changes that are needed to remove the "A CMP 0 ? A : -A" part from fold_cond_expr_with_comparison: * Need to

[COMMITTED] Fix PR 101230: ICE in fold_cond_expr_with_comparison

2021-06-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski This fixes PR 101230 where I had messed up and forgot that invert_tree_comparison can return ERROR_MARK if the comparsion is not invertable (floating point types). Committed as obvious after a bootstrap/test on x86_64-linux-gnu-gnu gcc/ChangeLog: PR middle-end/10123

[PATCH 0/4] v4 PHI-OPT move abs_replacement to match.pd

2021-06-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski To able to move PHI-OPT's abs_replacement to match.pd, a bunch of support needed to be added to PHI-OPT. This is a set of 4 (unapproved) patches which allows us to remove abs_replacement and even does one set further and does a few extra transformations that abs_replacement di

[PATCH 1/4] Duplicate the range information of the phi onto the new ssa_name

2021-06-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski Since match_simplify_replacement uses gimple_simplify, there is a new ssa name created sometimes and then we go and replace the phi edge with this new ssa name, the range information on the phi is lost. Placing this in replace_phi_edge_with_variable is the best option instead

[PATCH 2/4] Allow match-and-simplified phiopt to run in early phiopt

2021-06-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski To move a few things more to match-and-simplify from phiopt, we need to allow match_simplify_replacement to run in early phiopt. To do this we add a replacement for gimple_simplify that is explictly for phiopt. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressio

[PATCH 3/4] Try inverted comparison for match_simplify in phiopt

2021-06-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski Since match and simplify does not have all of the inverted comparison patterns, it make sense to just have phi-opt try to do the inversion and try match and simplify again. OK? Bootstrapped and tested on x86_64-linux-gnu. Thanks, Andrew Pinski gcc/ChangeLog: * tree

[PATCH 4/4] Port most of the A CMP 0 ? A : -A to match

2021-06-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski To improve phiopt and be able to remove abs_replacement, this ports most of "A CMP 0 ? A : -A" from fold_cond_expr_with_comparison to match.pd. There is a few extra changes that are needed to remove the "A CMP 0 ? A : -A" part from fold_cond_expr_with_comparison: * Need to

[PATCH] constexprify some tree variables

2022-11-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski Since we use C++11 by default now, we can use constexpr for some const decls in tree-core.h. This patch does that and it allows for better optimizations of GCC code with checking enabled and without LTO. For an example generic-match.cc compiling is speed up due to the less n

[PATCH] Fix PR 106560: Another ICE after conflicting types of redeclaration

2022-11-19 Thread apinski--- via Gcc-patches
From: Andrew Pinski This another one of these ICE after error issues with the gimplifier and a fallout from r12-3278-g823685221de986af. The problem here is gimplify_modify_expr does not check if either from or to was an error operand. This adds the check and fixes the ICE. OK? Bootstrapped and t

[PATCH] tree-optimization/103356 Add missing (~a) == b folding for _Bool

2022-11-26 Thread apinski--- via Gcc-patches
From: Andrew Pinski The following makes sure to fold (~a) == b to a ^ b for truth values. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski PR 103356 gcc/ChangeLog: * match.pd: ((~a) == b -> a ^ b): New pattern. gcc/testsuite/ChangeL

[COMMITTED] Fix comment for (A / (1 << B)) -> (A >> B).

2022-11-28 Thread apinski--- via Gcc-patches
From: Andrew Pinski There was a small typo where Also was done twice. The second also should have been handled. This fixes that. Committed as obvious after a build. gcc/ChangeLog: * match.pd ((A / (1 << B)) -> (A >> B).): Fix comment. --- gcc/match.pd | 2 +- 1 file changed, 1

[PATCH 1/2] Fix C/107926: Wrong error message when initializing char array

2022-11-30 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is the code which handles {"a"} is supposed to handle the case where the is something after the string but it only handles the case where there is another string so we go down the other path and error out saying "excess elements in struct initializer" even tho

<    1   2   3   >