Re: libsanitizer: sync from master

2023-04-30 Thread Martin Liška
On 4/28/23 11:23, Florian Weimer wrote: > * Martin Liška: > >> On 4/26/23 20:31, Florian Weimer wrote: >>> * Martin Liška: >>> On 11/15/22 16:47, Martin Liška wrote: > Hi. > > I've just pushed libsanitizer update that was tested on x86_64-linux and > ppc64le-linux systems. >>

RE: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-30 Thread Li, Pan2 via Gcc-patches
Thanks all for comments. Summary what I have learned from the mail thread as below. Please feel free to correct me if any mistake. 1. The RVV VMSET has tail policy and the high bits of target register can be overridden to 1 or retain the value they held according to the ISA. 2. The semantics of

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 https://gcc.

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

2023-04-30 Thread Jeff Law via Gcc-patches
On 11/30/22 10:18, apinski--- via Gcc-patches wrote: 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 o

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

2023-04-30 Thread Jeff Law via Gcc-patches
On 11/30/22 10:18, apinski--- via Gcc-patches wrote: 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

Re: [PATCH v2] gcc: Use ld -r when checking for HAVE_LD_RO_RW_SECTION_MIXING

2023-04-30 Thread Jeff Law via Gcc-patches
On 12/5/22 06:43, Joakim Nohlgård wrote: Fall back to ld -r if ld -shared fails during configure. The check for HAVE_LD_RO_RW_SECTION_MIXING can fail on targets where ld does not support shared objects, even though the answer to the test should be 'read-write'. One such target is riscv64-unkno

Re: [PATCH v5 00/11] RISC-V: Implement ISA Manual Table A.6 Mappings

2023-04-30 Thread Jeff Law via Gcc-patches
On 4/28/23 12:45, Hans Boehm wrote: We're certainly pushing for the same ABI (A.6 + trailing fence on store) in LLVM as well. I'm about to upload a pull request for the psABI document that describes this version of the ABI, and a bit of the rationale for it. I'll attach the current draft her

Re: [PATCH v5 06/11] RISC-V: Strengthen atomic stores

2023-04-30 Thread Jeff Law via Gcc-patches
On 4/28/23 15:42, Hans Boehm wrote: The concern with making the new behavior non-default is of course that the generated code will eventually end up on an A.7-capable platform. Yea, certainly a significant concern in general, though probably not for Ventana. I expect we'll have folks rebuild

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

2023-04-30 Thread Jeff Law via Gcc-patches
On 1/12/23 09:02, Longjun Luo via Gcc-patches wrote: From 0821df518b264e754d698d399f98be1a62945e32 Mon Sep 17 00:00:00 2001 From: Longjun Luo Date: Thu, 12 Jan 2023 23:59:54 +0800 Subject: [PATCH] libcpp: suppress builtin macro redefined warnings for  __LINE__ As implied in gcc.gnu.org/leg

Re: [PATCH V5] Use reg mode to move sub blocks for parameters and returns

2023-04-30 Thread Jeff Law via Gcc-patches
On 3/16/23 21:39, Jiufu Guo wrote: Hi, When assigning a parameter to a variable, or assigning a variable to return value with struct type, and the parameter/return is passed through registers. For this kind of case, it would be better to use the nature mode of the registers to move the conten

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

2023-04-30 Thread Jeff Law via Gcc-patches
On 4/28/23 11:02, Andrew Pinski via Gcc-patches wrote: 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

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

2023-04-30 Thread Jeff Law via Gcc-patches
On 4/28/23 11:02, Andrew Pinski via Gcc-patches wrote: 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

[PATCH (pushed)] libsanitizer: link hwasan against lsan library

2023-04-30 Thread Martin Liška
Similarly to libasan.so, libhwasan.so also utilizes some of the symbols from lsan library. PR sanitizer/109674 libsanitizer/ChangeLog: * hwasan/Makefile.am: Depend on liblsan. * hwasan/Makefile.in: Re-generate. --- libsanitizer/hwasan/Makefile.am | 2 +- libsanitizer/hwa

Re: [PATCH] Canonicalize vec_merge when mask is constant.

2023-04-30 Thread Jeff Law via Gcc-patches
On 4/19/23 21:58, liuhongt via Gcc-patches wrote: Use swap_communattive_operands_p for canonicalization. When both value has same operand precedence value, then first bit in the mask should select first operand. The canonicalization should help backends for pattern match. .i.e. x86 backend ha

[PATCH (pushed)] hwasan: adjust wording in expected output in tests

2023-04-30 Thread Martin Liška
gcc/testsuite/ChangeLog: * c-c++-common/hwasan/asan-pr70541.c: Adjust wording of expected output. * c-c++-common/hwasan/heap-overflow.c: Likewise. * c-c++-common/hwasan/sanity-check-pure-c.c: Likewise. * c-c++-common/hwasan/use-after-free.c: Likewise. --- g

Re: [PATCH 5/5] match.pd: Use splits in makefile and make configurable.

2023-04-30 Thread Jeff Law via Gcc-patches
On 4/28/23 04:44, Tamar Christina via Gcc-patches wrote: Hi All, This updates the build system to split up match.pd files into chunks of 10. This also introduces a new flag --with-matchpd-partitions which can be used to change the number of partitions. For the analysis of why 10 please look

Re: [PATCH] Turn on LRA on all targets

2023-04-30 Thread Jeff Law via Gcc-patches
On 4/23/23 10:47, Segher Boessenkool wrote: This minimal patch enables LRA for all targets. It does not clean up the target code, nor does it do anything to generic code: it just deletes all target definitions of TARGET_LRA_P. There are three kinds of changes: 1) Targets that already always

PING [C PATCH - backport 12] Fix ICE related to implicit access attributes for VLA arguments [PR105660]

2023-04-30 Thread Martin Uecker via Gcc-patches
Ok for 12.3 ? Am Mittwoch, dem 19.04.2023 um 18:39 +0200 schrieb Martin Uecker: > Ok to cherrypick for 12? It is in GCC 13 and fixes an > annoying ICE. > > Martin > > > > Here is a fix for PR105660. > > Bootstrapped and regression tested on x86-64. > > > Fix ICE related to implicit

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

[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] 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 m

[Committed] Update xstormy16's neghi2 pattern to not clobber the carry flag.

2023-04-30 Thread Roger Sayle
When I converted xstormy16's neghi2 pattern from a define_expand to a define_insn, I forgot that define_expand implicitly produces a sequence of instructions, but a define_insn is an implicit parallel, thereby messing up the clobber (reg:BI CARRY_REG), which can then cause an ICE in the auto-gener

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

2023-04-30 Thread Jeff Law via Gcc-patches
On 4/30/23 12:30, Jeff Law wrote: On 1/12/23 09:02, Longjun Luo via Gcc-patches wrote:  From 0821df518b264e754d698d399f98be1a62945e32 Mon Sep 17 00:00:00 2001 From: Longjun Luo Date: Thu, 12 Jan 2023 23:59:54 +0800 Subject: [PATCH] libcpp: suppress builtin macro redefined warnings for   __

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

2023-04-30 Thread Andrew Pinski via Gcc-patches
On Sun, Apr 30, 2023 at 4:15 PM Jeff Law via Gcc-patches wrote: > > > > On 4/30/23 12:30, Jeff Law wrote: > > > > > > On 1/12/23 09:02, Longjun Luo via Gcc-patches wrote: > >> From 0821df518b264e754d698d399f98be1a62945e32 Mon Sep 17 00:00:00 2001 > >> From: Longjun Luo > >> Date: Thu, 12 Jan 202

[COMMITTED] Remove irange::{min,max,kind}.

2023-04-30 Thread Aldy Hernandez via Gcc-patches
gcc/ChangeLog: * tree-ssa-loop-niter.cc (refine_value_range_using_guard): Remove kind() call. (determine_value_range): Same. (record_nonwrapping_iv): Same. (infer_loop_bounds_from_signedness): Same. (scev_var_range_cant_overflow): Same. * tre

[COMMITTED] Remove irange::tree_{lower,upper}_bound.

2023-04-30 Thread Aldy Hernandez via Gcc-patches
gcc/ChangeLog: * value-range.cc (irange::irange_set_anti_range): Remove uses of tree_lower_bound and tree_upper_bound. (irange::verify_range): Same. (irange::operator==): Same. (irange::singleton_p): Same. * value-range.h (irange::tree_lower_bound):

[COMMITTED] Various cleanups in vr-values.cc towards ranger API.

2023-04-30 Thread Aldy Hernandez via Gcc-patches
gcc/ChangeLog: * vr-values.cc (check_for_binary_op_overflow): Tidy up by using ranger API. (compare_ranges): Delete. (compare_range_with_value): Delete. (bounds_of_var_in_loop): Tidy up by using ranger API. (simplify_using_ranges::fold_cond_with_ops)

[COMMITTED] vrange_storage overhaul

2023-04-30 Thread Aldy Hernandez via Gcc-patches
[tl;dr: This is a rewrite of value-range-storage.* such that global ranges and the internal ranger cache can use the same efficient storage mechanism. It is optimized such that when wide_ints are dropped into irange, the copying back and forth from storage will be very fast, while being able to ho

[COMMITTED] Cleanup irange::set.

2023-04-30 Thread Aldy Hernandez via Gcc-patches
Now that anti-ranges are no more and iranges contain wide_ints instead of trees, various cleanups are possible. This is one of a handful of patches improving the performance of irange::set() which is not on a hot path, but quite sensitive because it is so pervasive. gcc/ChangeLog: * gimp

[COMMITTED] Replace vrp_val* with wide_ints.

2023-04-30 Thread Aldy Hernandez via Gcc-patches
This patch removes all uses of vrp_val_{min,max} in favor for a irange_val_* which are wide_int based. This will leave only one use of vrp_val_* which returns trees in range_of_ssa_name_with_loop_info() because it needs to work with non-integers (floats, etc). In a follow-up patch, this function

[COMMITTED] Merge irange::union/intersect into irange_union/intersect.

2023-04-30 Thread Aldy Hernandez via Gcc-patches
gcc/ChangeLog: * value-range.cc (irange::irange_union): Rename to... (irange::union_): ...this. (irange::irange_intersect): Rename to... (irange::intersect): ...this. * value-range.h (irange::union_): Delete. (irange::intersect): Delete. --- gcc/val

[COMMITTED] Convert internal representation of irange to wide_ints.

2023-04-30 Thread Aldy Hernandez via Gcc-patches
gcc/ChangeLog: * range-op.cc (update_known_bitmask): Adjust for irange containing wide_ints internally. * tree-ssanames.cc (set_nonzero_bits): Same. * tree-ssanames.h (set_nonzero_bits): Same. * value-range-storage.cc (irange_storage::set_irange): Same.

[COMMITTED] Convert get_legacy_range in bounds_of_var_in_loop to irange API.

2023-04-30 Thread Aldy Hernandez via Gcc-patches
gcc/ChangeLog: * vr-values.cc (bounds_of_var_in_loop): Convert to irange API. --- gcc/vr-values.cc | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/vr-values.cc b/gcc/vr-values.cc index 7f623102ac6..3d28198f9f5 100644 --- a/gcc/vr-values.cc +++ b/gcc/vr-value

[COMMITTED] Rewrite bounds_of_var_in_loop() to use ranges.

2023-04-30 Thread Aldy Hernandez via Gcc-patches
Little by little, bounds_of_var_in_loop() has grown into an unmaintainable mess. This patch rewrites the code to use the relevant APIs as well as refactor it to make it more readable. gcc/ChangeLog: * gimple-range-fold.cc (tree_lower_bound): Delete. (tree_upper_bound): Delete.

[COMMITTED] Inline irange::set_nonzero.

2023-04-30 Thread Aldy Hernandez via Gcc-patches
irange::set_nonzero is used everywhere and benefits immensely from inlining. gcc/ChangeLog: * value-range.h (irange::set_nonzero): Inline. --- gcc/value-range.h | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc/value-range.h b/gcc/value-range.h

[COMMITTED] Conversion to irange wide_int API.

2023-04-30 Thread Aldy Hernandez via Gcc-patches
This converts the irange API to use wide_ints exclusively, along with its users. This patch will slow down VRP, as there will be more useless wide_int to tree conversions. However, this slowdown is only temporary, as a follow-up patch will convert the internal representation of iranges to wide_in

[COMMITTED] Remove unused friends in int_range<>.

2023-04-30 Thread Aldy Hernandez via Gcc-patches
gcc/ChangeLog: * value-range.h (class int_range): Remove gt_ggc_mx and gt_pch_nx friends. --- gcc/value-range.h | 5 - 1 file changed, 5 deletions(-) diff --git a/gcc/value-range.h b/gcc/value-range.h index 5cff50e6d03..ab8d7d3c5dc 100644 --- a/gcc/value-range.h +++ b/gcc/val