[PATCH 2/2] Improve error message for excess elements in array initializer from {"a"}

2022-11-30 Thread apinski--- via Gcc-patches
From: Andrew Pinski So char arrays are not the only type that be initialized from {"a"}. We can have wchar_t (L"") and char16_t (u"") types too. So let's print out the type of the array instead of just saying char. Note in the testsuite I used regex . to match '[' and ']' as I could not figure

[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

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

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

[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

[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

[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

[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

[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

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

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

[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

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

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

[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

[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

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

[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

[PATCH 2/2] Add assert for type on tree_nonzero_bits

2022-11-02 Thread apinski--- via Gcc-patches
From: Andrew Pinski Right now anyone could call tree_nonzero_bits with either complex or vector types and this will return the wrong thing. So just assert that nobody calls it with this. OK? Bootstrapped and tested with no regressions on x86_64-linux-gnu. gcc/ChangeLog: *

[PATCH 0/2] tree_nonzero_bits vs vector and complex types

2022-11-02 Thread apinski--- via Gcc-patches
From: Andrew Pinski While looking at older unconfirmed bug reports, I noticed there was an ubsan found issue and noticed tree_nonzero_bits was being called with a vector type. How ubsan found it was at the end of tree_nonzero_bits, did "return wi::shwi (-1, TYPE_PRECISION (TREE_TYPE (t)));" and

[PATCH 1/2] Fix PR 105532: match.pd patterns calling tree_nonzero_bits with vector types

2022-11-02 Thread apinski--- via Gcc-patches
From: Andrew Pinski 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. OK? Bootstrapped and tested on

[PATCH] Use simple_dce_from_worklist with match_simplify_replacement.

2022-10-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski This is a simple patch to do some DCE after a successful match and simplify replacement in PHI-OPT. match and simplify likes to generate some extra statements which should be cleaned up. OK? Bootstrapped and tested on x86_64-linux with no regressions. Thanks, Andrew Pinski

[PATCH 3/3] Fix PR 106690: enable effective_target_bswap for RISCV targets with ZBB enabled by default

2022-08-20 Thread apinski--- via Gcc-patches
From: Andrew Pinski While looking for testcases to quickly test, I Noticed that check_effective_target_bswap was not enabled for riscv when ZBB is enabled. This patch checks if ZBB is enabled when targeting RISCV* for bswap. OK? Ran the testsuite for riscv32-linux-gnu both with and without ZBB

[PATCH 1/3] Fix PR 106600: __builtin_bswap32 is not hooked up for ZBB for 32bit

2022-08-20 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is the bswap2 pattern had a check for TARGET_64BIT but then used the X iterator. Since the X iterator is either SI or DI depending on the setting TARGET_64BIT, there is no reason for the TARGET_64BIT. OK? Built and tested on both riscv32-linux-gnu and

[PATCH 2/3] Fix PR 106601: __builtin_bswap16 code gen could be improved with ZBB enabled

2022-08-20 Thread apinski--- via Gcc-patches
From: Andrew Pinski The default expansion for bswap16 is two extractions (shift/and) followed by an insertation (ior) and then a zero extend. This can be improved with ZBB enabled to just full byteswap followed by a (logical) shift right. This patch adds a new pattern for this which does that.

[PATCH 0/3] [RISCV] Improve bswap for ZBB

2022-08-20 Thread apinski--- via Gcc-patches
From: Andrew Pinski Just some improvements for bswap and ZBB including a testsuite change that will allow more testing to happen. Thanks, Andrew Pinski Andrew Pinski (3): Fix PR 106600: __builtin_bswap32 is not hooked up for ZBB for 32bit Fix PR 106601: __builtin_bswap16 code gen could be

[PATCH 05/10] [RISCV] Add %~ to print w if TARGET_64BIT and use it

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski To make things easier and more maintainable, we need to add support printing out w if TARGET_64BIT so this patch adds %~ to do that, similar how the x86 backend uses %~ to print out i/f for TARGET_AVX2. We could have chosen any punctuation symbol but ~ looks the closest to w.

[PATCH 07/10] [RISCV] Use a constraint for bset_mask and bset_1_mask

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski A constraint here just makes it easier to understand what the operands are. OK? Built and tested on riscv32-linux-gnu and riscv64-linux-gnu with --with-arch=rvNimafdc_zba_zbb_zbc_zbs (where N is 32 and 64). Thanks, Andrew Pinski gcc/ChangeLog: *

[PATCH 10/10] [RISCV] Fix PR 106632 and PR 106588 a few constraints in bitmanip.md

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski The constraints should be n instead of i. Also there needs to a check for out of bounds zero_extract for *bexti. gcc/ChangeLog: PR target/106632 PR target/106588 * config/riscv/bitmanip.md (*shNadduw): Use n constraint instead of i.

[PATCH 09/10] [RISCV] Add constraints for not_single_bit_mask_operand/single_bit_mask_operand

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski Like a previous patch, just add constraints for predicates not_single_bit_mask_operand and single_bit_mask_operand. OK? Built and tested for riscv32-linux-gnu and riscv64-linux-gnu. Thanks, Andrew Pinski gcc/ChangeLog: * config/riscv/constraints.md (DbS): New

[PATCH 08/10] [RISCV] Fix PR 106586: riscv32 vs ZBS

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is two fold. With RISCV32, 32bit const_int are always signed extended to 64bit in HWI. So that means for SINGLE_BIT_MASK_OPERAND, it should mask off the upper bits to see it is a single bit for !TARGET_64BIT. Plus there are a few locations which forget to

[PATCH 06/10] [RISCV] Use constraints/predicates instead of checking const_int directly for shNadd patterns

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski This simplifies the code by adding a predicate and a constraint for 1/2/3. The aarch64 backend has a similar predicate called aarch64_shift_imm_ which they use there. OK? Built and tested on riscv32-linux-gnu and riscv64-linux-gnu with no regressions. Thanks, Andrew Pinski

[PATCH 01/10] [RISCV] Move iterators from riscv.md to iterators.md

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski This moves the iterators out from riscv.md to iterators.md like most modern backends. I have not moved the iterators from the other .md files yet. OK? Build and tested on riscv64-linux-gnu and riscv32-linux-gnu. Thanks, Andrew Pinski gcc/ChangeLog: *

[PATCH 03/10] [RISCV] Move iterators from sync.md to iterators.md

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski Like the previous two patches this moves the iterators that are in sync.md to iterators.md. OK? build and tested for riscv64-linux-gnu. gcc/ChangeLog: * config/riscv/sync.md (any_atomic, atomic_optab): Move to ... * config/riscv/iterators.md: Here. ---

[PATCH 02/10] [RISCV] Move iterators from bitmanip.md to iterators.md

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski Just like the previous patch this move all of the iterators of bitmanip.md to iterators.md. All modern backends put the iterators in iterators.md for easier access. OK? Built and tested for riscv32-linux-gnu with --with-arch=rv32imafdc_zba_zbb_zbc_zbs. Thanks, Andrew

[PATCH 04/10] [RISCV] Add the list of operand modifiers to riscv.md too

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski To make it easier to find operands modifiers while in the md file, add the list of modifiers to the top of the md file. This is similar to i386 target. OK? Built and tested for riscv32-linux-gnu and riscv64-linux-gnu. gcc/ChangeLog: * config/riscv/riscv.cc

[PATCH 00/10] [RISCV] Fix/improve the RISCV backend

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski This set of patches fixes a few RISCV issues and does a few cleanups. Including moving all of the iterators to iterators.md like many newer backends. It also fixes a few PRs which I filed including the RISCV32 issue with ZBS enabled. Thanks, Andrew Pinski Andrew Pinski

[COMMITTED] [AARCH64] Remove reference to MD_INCLUDES

2022-08-11 Thread apinski--- via Gcc-patches
From: Andrew Pinski The comment reference to MD_INCLUDES is not needed as it is auto generated for long time now even before aarch64 target was added. MD_INCLUDES has been auto generated since r0-64489. Note some targets still manually set MD_INCLUDES and I suspect those can be changed but I

[PATCH] Fix middle-end/103645: empty struct store not removed when using compound literal

2022-08-07 Thread apinski--- via Gcc-patches
From: Andrew Pinski For compound literals empty struct stores are not removed as they go down a different path of the gimplifier; trying to optimize the init constructor. This fixes the problem by not adding the gimple assignment at the end of gimplify_init_constructor if it was an empty type.

[COMMITTED] Move testcase gcc.dg/tree-ssa/pr93776.c to gcc.c-torture/compile/pr93776.c

2022-08-07 Thread apinski--- via Gcc-patches
From: Andrew Pinski Since this testcase is not exactly SSA specific and it would be a good idea to compile this at more than just at -O1, moving it to gcc.c-torture/compile would do that. Committed as obvious after a test on x86_64-linux-gnu. gcc/testsuite/ChangeLog: *

[COMMITED] [RSIC-V] Fix 32bit riscv with zbs extension enabled

2022-08-04 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here was a disconnect between splittable_const_int_operand predicate and the function riscv_build_integer_1 for 32bits with zbs enabled. The splittable_const_int_operand predicate had a check for TARGET_64BIT which was not needed so this patch removed it.

[COMMITTED] Fix tree-opt/PR106087: ICE with inline-asm with multiple output and assigned only static vars

2022-07-08 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is that when we mark the ssa name that was referenced in the now removed dead store (to a write only static variable), the inline-asm would also be removed even though it was defining another ssa name. This fixes the problem by checking to make sure that

[PATCH] Fix tree-opt/PR106087: ICE with inline-asm with multiple output and assigned only static vars

2022-07-07 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is that when we mark the ssa name that was referenced in the now removed dead store (to a write only static variable), the inline-asm would also be removed even though it was defining another ssa name. This fixes the problem by checking to make sure that

[PATCH] c: [PR104506] Fix ICE after error due to change of type to error_mark_node

2022-02-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is we end up with an error_mark_node when calling useless_type_conversion_p and that ICEs. STRIP_NOPS/tree_nop_conversion has had a check for the inner type being an error_mark_node since g9a6bb3f78c96 (2000). This just adds the check also to

[PATCH] [COMMITTED] Fix PR aarch64/104474: ICE with vector float initializers and non-consts.

2022-02-09 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is that the aarch64 back-end was placing const0_rtx into the constant vector RTL even if the mode was a floating point mode. The fix is instead to use CONST0_RTX and pass the mode to select the correct zero (either const_int or const_double). Committed as

[PATCH] [COMMITTED] Change multiprecision.org to use https

2022-02-01 Thread apinski--- via Gcc-patches
From: Andrew Pinski As reported at https://gcc.gnu.org/pipermail/gcc/2022-February/238216.html, multiprecision.org now uses https so this updates the documentation to use https instead of http. Committed as obvious. gcc/ChangeLog: * doc/install.texi: --- gcc/doc/install.texi | 2 +-

[PATCH] Fix comment for operand_compare::operand_equal_p.

2022-01-31 Thread apinski--- via Gcc-patches
From: Andrew Pinski The OEP_* enums were moved to tree-core.h in r0-124973-g5e351e960763 but the comment was correct when it was added added to fold-const.h in r10-4231-g7f4a8ee03d40. This fixes the reference to the OEP_* enum to reference tree-core. Committed as obvious after a bootstrap/test

[PATCH] Fix aarch64/104201: branch-protection-attr.c fails after quoting difference

2022-01-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski After the quoting changes in r12-6521-g03a1a86b5ee40d4e240, branch-protection-attr.c fails due to expecting a different quoting type for "leaf". This patch changes the quoting from "" to '' as that is what is used now. Committed as obvious after a test of the testcase.

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

2022-01-26 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

[PATCH v3] [AARCH64] Fix PR target/103100 -mstrict-align and memset on not aligned buffers

2022-01-25 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is that aarch64_expand_setmem does not change the alignment for strict alignment case. This is version 3 of this patch, is is based on version 2 and moves the check for the number of instructions from the optimizing for size case to be always and change the

[PATCH] [aarch64/64821]: Simplify __builtin_aarch64_sqrt* into internal function .SQRT.

2022-01-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski This is a simple patch which simplifies the __builtin_aarch64_sqrt* builtins into the internal function SQRT which allows for constant folding and other optimizations at the gimple level. It was originally suggested we do to __builtin_sqrt just for __builtin_aarch64_sqrtdf

[PATCH] [COMMITTED] Improve coment for the newly added code in ipa-split.

2022-01-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski It was pointed out to me by Jakub, that the comment in front of the new code which handles warning/error attribute was not really understandable. This fixes the comment to be understandable; I don't know why I wrote the original comment that way even. Committed as obvious

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

2022-01-18 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

[PATCH] [aarch64/64821]: Simplify __builtin_aarch64_sqrt* into internal function .SQRT.

2022-01-10 Thread apinski--- via Gcc-patches
From: Andrew Pinski This is a simple patch which simplifies the __builtin_aarch64_sqrt* builtins into the internal function SQRT which allows for constant folding and other optimizations at the gimple level. It was originally suggested we do to __builtin_sqrt just for __builtin_aarch64_sqrtdf

[PATCH] Fix PR 59447: --with-dwarf2 should mention or later.

2022-01-06 Thread apinski--- via Gcc-patches
From: Andrew Pinski Dwarf3/4/5 are really just extensions (well not fully) on top of dwarf2 and the option --with-dwarf2 just changes the default to emit dwarf 2, 3, 4, or 5 by default. On the trunk, dwarf 5 is enabled by this configure option. gcc/ChangeLog: PR bootstrap/59447

[PATCH] Fix target/103910: missing GTY on x86_mfence causing PCH usage to ICE

2022-01-05 Thread apinski--- via Gcc-patches
From: Andrew Pinski With -O3 -march=opteron, a mfence builtin is added after the loop to say the nontemporal stores are no longer needed. This all good without precompiled headers as the function decl that is referneced by x86_mfence is referenced in another variable but with precompiled

[PATCH] [COMMITTED] c++: [PR90782] Add testcase

2022-01-03 Thread apinski--- via Gcc-patches
From: Andrew Pinski This testcase was fixed by r12-1744-g3eecc1 as it make sense it fixed a few other class deduction issues. So I thought I would add a testcase for this PR and close it as fixed. Committed after a quick test of the testcase. PR c++/90782 gcc/testsuite/ChangeLog:

[PATCH] Revamp documentation for _Complex types extension

2022-01-02 Thread apinski--- via Gcc-patches
From: Andrew Pinski While cleaning up the bug database, I noticed there was a request to improve the documentation of the _Complex type extensions. So I rewrote part of the documentation to make things clearer on __real/__imag and even added documentation about casts between the scalar and the

[PATCH] Committed: Add testcases for a few PRs

2022-01-01 Thread apinski--- via Gcc-patches
From: Andrew Pinski These were fixed as part of the fix for PR 99766, I thought it would be useful to add a few testcases for the other cases that were failing. Committed as obvious after running the tests to make sure they work. PR rtl-optimization/100241 PR

[PATCH] Change the xfail in gcc.dg/uninit-pr89230-1.c

2021-12-19 Thread apinski--- via Gcc-patches
From: Andrew Pinski With the recent PHI-OPT patch for line numbers, I had missed this testcase was now failing. The uninitialized warning was there before my recent patch, just was on the wrong line. The testcase had added an xfail in r12-4698-gf6d012338 (though a bug report was not filed to

[PATCH] Improve location for new statements in match-and-simplify phiopt

2021-12-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski Before match-and-simplify was used in phiot, the location of the new stamtents were all of that of the conditional, this adds that back as I did not realize gimple_simplify didn't do that for you. OK? Bootstrapped and tested on x86_64 with no regressions. gcc/ChangeLog:

[PATCH] Fix C++/93809 and C++/83469: typenames and unions

2021-12-07 Thread apinski--- via Gcc-patches
From: Andrew Pinski There are a few issues here with typenames and unions (and even struct keywords with unions). First in cp_parser_check_class_key, we need to allow typenames to name union types and union key to be able to use with typenames. The next issue is we need to record if we had a

[PATCH] [Committed] New testcase for C++/71792, bitfields and auto

2021-12-03 Thread apinski--- via Gcc-patches
From: Andrew Pinski This testcase used to fail before GCC 6.4.0 due to the wrong type being used for auto when used with bitfields, the C++ front-end was using the "bitfield" type rather than the underlaying type. Committed the testcase after a quick check. PR c++/71792

[PATCH] tree-optimization: [PR101540] Simplify CONSTRUCTOR for vector(1) to be VCE

2021-11-28 Thread apinski--- via Gcc-patches
From: Andrew Pinski This just adds a simplification to simplify_vector_constructor for vector of 1 element to be VCE which should reduce memory usage in the compiler and maybe allow for some more optimizations. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR

[PATCH] Fix PR 19089: Environment variable TMP may yield gcc: abort

2021-11-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski Even though I cannot reproduce the ICE any more, this is still a bug. We check already to see if we can access the directory but never check to see if the path is actually a directory. This adds the check and now we reject the file as not usable as a tmp directory. OK?

[PATCH] Fix PR 62157: disclean in libsanitizer not working

2021-11-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski So what is happening is DIST_SUBDIRS contains the conditional directories which is wrong, so we need to force DIST_SUBDIRS to be the same as SUBDIRS as recommened by the automake manual. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Also now make

[PATCH v2] Canonicalize [ssa_n, CST] to ssa_n p+ CST in fold_stmt_1

2021-11-22 Thread apinski--- via Gcc-patches
From: Andrew Pinski This is a new version of the patch to fix PR 102216. Instead of doing the canonicalization inside forwprop, Richi mentioned we should do it inside fold_stmt_1 and that is what this patch does. PR tree-optimization/102216 gcc/ChangeLog: * gimple-fold.c

[PATCH 2/2] tree-optimization: [PR92342] Move b & -(a==c) optimization to the gimple level

2021-11-21 Thread apinski--- via Gcc-patches
From: Andrew Pinski Combine disabled this optimization in r10-254-gddbb5da5199fb42 but it makes sense to do this on the gimple level and then let expand decide which way is better. So this adds the transformation on the gimple level (late like was done for the multiply case). OK? Bootstrapped

[PATCH 1/2] Improve/Fix (m1 CMP m2) * d -> (m1 CMP m2) ? d : 0 pattern.

2021-11-21 Thread apinski--- via Gcc-patches
From: Andrew Pinski The pattern here was not catching all comparisons and the multiply was not commutative when it should have been. This patches fixes that by using tcc_comparison and adding :c to the multiply. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

[PATCH] tree-optimization: [PR31531] Improve ~a < CST, allow a nop cast inbetween ~ and a

2021-11-21 Thread apinski--- via Gcc-patches
From: Andrew Pinski This PR was orignally for the missed optimization of a few isnegative which had been solved a long time ago (sometime before 4.4.0). I noticed there was one missed optimization on the gimple level. There is a match.pd pattern for ~a < CST but we miss that there could be a

[PATCH] Fix tree-optimization/103220: Another missing folding of (type) X op CST where type is a nop convert

2021-11-19 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is that int_fits_type_p will return false if we just change the sign of things like -2 (or 254) so we should accept the case where we just change the sign (and not the precision) of the type. OK? Bootstrapped and tested on x86_64-linux-gnu with no

[PATCH] Fix tree-optimization/103314 : Limit folding of (type) X op CST where type is a nop convert to gimple

2021-11-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski There is some re-association code in fold_binary which conflicts with this optimization due keeping around some "constants" which are not INTEGER_CST (1 << -1) so we end up in an infinite loop because of that. So we need to limit this case to GIMPLE level only. OK?

[PATCH v2] [AARCH64] Fix PR target/103100 -mstrict-align and memset on not aligned buffers

2021-11-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is that aarch64_expand_setmem does not change the alignment for strict alignment case. This is a simplified patch from what I had previously. So constraining copy_limit to the alignment of the mem in the case of strict align fixes the issue without checking

[PATCH] Fix PR 103317, ICE after PHI-OPT, minmax_replacement producing invalid SSA

2021-11-18 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 the basic block does not need to be empty but still needs to have a single predecessor. This patch fixes that over sight. OK? Bootstrapped and tested on

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

2021-11-17 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

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

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

[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

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

[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

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

[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

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

[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

[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

[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

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

2021-11-06 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, creating a new register always is better. OK? Bootstrapped and tested on aarch64-linux-gnu with no

[PATCH] Fix PR target/103100 -mstrict-align and memset on not aligned buffers

2021-11-05 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is with -mstrict-align, aarch64_expand_setmem needs to check the alginment of the mode to make sure we can use it for doing the stores. gcc/ChangeLog: PR target/103100 * config/aarch64/aarch64.c (aarch64_expand_setmem): Add check for

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

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

[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

[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

[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

[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

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

[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

[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

[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

  1   2   >