Re: Fix one issue in OpenMP 'requires' directive diagnostics (was: [Patch][v5] OpenMP: Move omp requires checks to libgomp)

2022-07-07 Thread Thomas Schwinge
Hi! On 2022-07-07T15:56:28+0200, Tobias Burnus wrote: > On 07.07.22 15:26, Thomas Schwinge wrote: >> On 2022-07-01T23:08:16+0200, Tobias Burnus >> wrote: >>> Updated version attached – I hope I got everything right, but I start to >>> get tired, I am not 100% sure. >> ..., and so the obligatory

Re: [PATCH] Introduce hardbool attribute for C

2022-07-07 Thread Richard Biener via Gcc-patches
On Thu, Jul 7, 2022 at 10:00 PM Alexandre Oliva via Gcc-patches wrote: > > > This patch introduces hardened booleans in C. The hardbool attribute, > when attached to an integral type, turns it into an enumerate type > with boolean semantics, using the named or implied constants as > representatio

Re: [PATCH/RFC] combine_completed global variable.

2022-07-07 Thread Richard Biener via Gcc-patches
On Thu, Jul 7, 2022 at 9:41 PM Roger Sayle wrote: > > > Hi Kewen (and Segher), > Many thanks for stress testing my patch to improve multiplication > by integer constants on rs6000 by using the rldmi instruction. > Although I've not been able to reproduce your ICE (using gcc135 > on the compile far

Re: [x86 PATCH] Support *testdi_not_doubleword during STV pass.

2022-07-07 Thread Uros Bizjak via Gcc-patches
On Thu, Jul 7, 2022 at 6:41 PM Roger Sayle wrote: > > > This patch fixes the current two FAILs of pr65105-5.c on x86 when > compiled with -m32. These (temporary) breakages were fallout from my > patches to improve/upgrade (scalar) double word comparisons. > On mainline, the i386 backend currently

RE: [PATCH]middle-end: don't lower past veclower [PR106063]

2022-07-07 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Richard Biener > Sent: Thursday, July 7, 2022 8:47 AM > To: Tamar Christina > Cc: gcc-patches@gcc.gnu.org; nd > Subject: RE: [PATCH]middle-end: don't lower past veclower [PR106063] > > On Thu, 7 Jul 2022, Tamar Christina wrote: > > > > -Original Message

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

Re: [PATCH v2 1/7] config: use $EGREP instead of egrep

2022-07-07 Thread Eric Gallager via Gcc-patches
On Mon, Jun 27, 2022 at 2:07 AM Xi Ruoyao via Gcc-patches wrote: > > egrep has been deprecated in favor of grep -E for a long time, and the > next GNU grep release (3.8 or 4.0) will print a warning if egrep is used. > Unfortunately, old hosts with non-GNU grep may lack the support for -E > option.

[pushd][PATCH v4] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero.

2022-07-07 Thread Lulu Cheng
Pushed for trunk and gcc-12. r13-1569-gaa8fd7f65683ef. r12-8558-ge623829c18ec29 Under the LA architecture, when the stack is dropped too far, the process of dropping the stack is divided into two steps. step1: After dropping the stack, save callee saved registers on the stack. s

[PATCH] diagnostics: Make line-ending logic consistent with libcpp [PR91733]

2022-07-07 Thread Lewis Hyatt via Gcc-patches
Hello- The PR (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91733) points out that, while libcpp recognizes a lone '\r' as a valid line-ending character, the infrastructure that obtains source lines to be printed in diagnostics does not, and hence diagnostics do not output the intended portion of

Re: [PATCH 0/2] loongarch: improve code generation for integer division

2022-07-07 Thread Lulu Cheng
在 2022/7/7 上午10:23, Xi Ruoyao 写道: We were generating some unnecessary instructions for integer division. These two patches improve the code generation to compile template T div(T a, T b) { return a / b; } into a single division instruction (along with a return instruction of course) as

Re: [RFA] Improve initialization of objects when the initializer has trailing zeros.

2022-07-07 Thread Takayuki 'January June' Suwa via Gcc-patches
On 2022/07/07 23:46, Jeff Law wrote: > This is an update to a patch originally posted by Takayuki Suwa a few months > ago. > > When we initialize an array from a STRING_CST we perform the initialization > in two steps.  The first step copies the STRING_CST to the destination.  The > second step

libbacktrace patch committed: Don't exit Mach-O dyld loop on failure

2022-07-07 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch changes the loop over dynamic libraries on Mach-O to keep going if we fail to find the debug info for a particular library. We can still pick up debug info for other libraries even if one fails. Tested on x86_64-pc-linux-gnu which admittedly does little, but others have te

libbacktrace patch committed: Don't let "make clean" remove allocfail.sh

2022-07-07 Thread Ian Lance Taylor via Gcc-patches
The script allocfail.sh was being incorrectly removed by "make clean". This patch fixes the problem. This fixes https://github.com/ianlancetaylor/libbacktrace/issues/81. Ran libbacktrace "make check" and "make clean" on x86_64-pc-linux-gnu. Committed to mainline. Ian For https://github.com/ianl

Re: [PATCH] Be careful with MODE_CC in simplify_const_relational_operation.

2022-07-07 Thread Segher Boessenkool
Hi! On Thu, Jul 07, 2022 at 10:08:04PM +0100, Roger Sayle wrote: > I think it's fair to describe RTL's representation of condition flags > using MODE_CC as a little counter-intuitive. "A little challenging", and you should see that as a good thing, as a puzzle to crack :-) > For example, the i38

Re: [PATCH 08/17] openmp: -foffload-memory=pinned

2022-07-07 Thread Andrew Stubbs
On 07/07/2022 12:54, Tobias Burnus wrote: Hi Andrew, On 07.07.22 12:34, Andrew Stubbs wrote: Implement the -foffload-memory=pinned option such that libgomp is instructed to enable fully-pinned memory at start-up.  The option is intended to provide a performance boost to certain offload programs

[PATCH] Be careful with MODE_CC in simplify_const_relational_operation.

2022-07-07 Thread Roger Sayle
I think it's fair to describe RTL's representation of condition flags using MODE_CC as a little counter-intuitive. For example, the i386 backend represents the carry flag (in adc instructions) using RTL of the form "(ltu:SI (reg:CCC) (const_int 0))", where great care needs to be taken not to trea

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2022-07-07 Thread Jonathan Wakely via Gcc-patches
On Thu, 7 Jul 2022 at 20:29, Jason Merrill wrote: > > On 7/7/22 13:14, Jonathan Wakely wrote: > > This adds a new built-in to replace the recursive class template > > instantiations done by traits such as std::tuple_element and > > std::variant_alternative. The purpose is to select the Nth type fr

Re: kernel sparse annotations vs. compiler attributes and debug_annotate_{type,decl} WAS: Re: [PATCH 0/9] Add debug_annotate attributes

2022-07-07 Thread Jose E. Marchesi via Gcc-patches
Hi Yonghong. > On 6/21/22 9:12 AM, Jose E. Marchesi wrote: >> >>> On 6/17/22 10:18 AM, Jose E. Marchesi wrote: Hi Yonghong. > On 6/15/22 1:57 PM, David Faust wrote: >> >> On 6/14/22 22:53, Yonghong Song wrote: >>> >>> >>> On 6/7/22 2:43 PM, David Faust wrote: >

[PATCH] Control flow redundancy hardening

2022-07-07 Thread Alexandre Oliva via Gcc-patches
This patch introduces an optional hardening pass to catch unexpected execution flows. Functions are transformed so that basic blocks set a bit in an automatic array, and (non-exceptional) function exit edges check that the bits in the array represent an expected execution path in the CFG. Funct

[pushed 1/2] Convert label_text to C++11 move semantics

2022-07-07 Thread David Malcolm via Gcc-patches
libcpp's class label_text stores a char * for a string and a flag saying whether it owns the buffer. I added this class before we could use C++11, and so to avoid lots of copying it required an explicit call to label_text::maybe_free to potentially free the buffer. Now that we can use C++11, this

[pushed 2/2] analyzer: use label_text for superedge::get_description

2022-07-07 Thread David Malcolm via Gcc-patches
No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Lightly tested with valgrind. Pushed to trunk as r13-1564-g52f538fa4a13d5. gcc/analyzer/ChangeLog: * checker-path.cc (start_cfg_edge_event::get_desc): Update for superedge::get_descripti

[PATCH] Introduce hardbool attribute for C

2022-07-07 Thread Alexandre Oliva via Gcc-patches
This patch introduces hardened booleans in C. The hardbool attribute, when attached to an integral type, turns it into an enumerate type with boolean semantics, using the named or implied constants as representations for false and true. Expressions of such types decay to _Bool, trapping if the

[pushed] analyzer: fix false positives from -Wanalyzer-tainted-divisor [PR106225]

2022-07-07 Thread David Malcolm via Gcc-patches
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r13-1562-g897b3b31f0a94b. gcc/analyzer/ChangeLog: PR analyzer/106225 * sm-taint.cc (taint_state_machine::on_stmt): Move handling of assignments from division to... (taint_state_machine

[PATCH/RFC] combine_completed global variable.

2022-07-07 Thread Roger Sayle
Hi Kewen (and Segher), Many thanks for stress testing my patch to improve multiplication by integer constants on rs6000 by using the rldmi instruction. Although I've not been able to reproduce your ICE (using gcc135 on the compile farm), I completely agree with Segher's analysis that the Achilles

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2022-07-07 Thread Jason Merrill via Gcc-patches
On 7/7/22 13:14, Jonathan Wakely wrote: This adds a new built-in to replace the recursive class template instantiations done by traits such as std::tuple_element and std::variant_alternative. The purpose is to select the Nth type from a list of types, e.g. __builtin_type_pack_element(1, char, int

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-07 Thread Jason Merrill via Gcc-patches
On 7/7/22 11:16, Patrick Palka wrote: On Thu, 7 Jul 2022, Jason Merrill wrote: On 7/6/22 15:26, Patrick Palka wrote: On Tue, 5 Jul 2022, Jason Merrill wrote: On 7/5/22 10:06, Patrick Palka wrote: On Fri, 1 Jul 2022, Jason Merrill wrote: On 6/29/22 13:42, Patrick Palka wrote: In r13-1045-

Re: [PATCH v2] Modify combine pattern by a pseudo AND with its nonzero bits [PR93453]

2022-07-07 Thread Segher Boessenkool
Hi! On Thu, Jul 07, 2022 at 04:30:50PM +0800, HAO CHEN GUI wrote: > This patch modifies the combine pattern after recog fails. With a helper It modifies combine itself, not just a pattern in the machine description. > - change_pseudo_and_mask, it converts a single pseudo to the pseudo AND with

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2022-07-07 Thread Marek Polacek via Gcc-patches
On Thu, Jul 07, 2022 at 06:14:36PM +0100, Jonathan Wakely wrote: > This adds a new built-in to replace the recursive class template > instantiations done by traits such as std::tuple_element and > std::variant_alternative. The purpose is to select the Nth type from a > list of types, e.g. __builtin

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-07 Thread Patrick Palka via Gcc-patches
On Thu, 7 Jul 2022, Patrick Palka wrote: > On Thu, 7 Jul 2022, Jason Merrill wrote: > > > On 7/6/22 15:26, Patrick Palka wrote: > > > On Tue, 5 Jul 2022, Jason Merrill wrote: > > > > > > > On 7/5/22 10:06, Patrick Palka wrote: > > > > > On Fri, 1 Jul 2022, Jason Merrill wrote: > > > > > > > > >

[PATCH] c++: Define built-in for std::tuple_element [PR100157]

2022-07-07 Thread Jonathan Wakely via Gcc-patches
This adds a new built-in to replace the recursive class template instantiations done by traits such as std::tuple_element and std::variant_alternative. The purpose is to select the Nth type from a list of types, e.g. __builtin_type_pack_element(1, char, int, float) is int. For a pathological examp

[PATCH] libstdc++: Prefer const T to std::add_const_t

2022-07-07 Thread Jonathan Wakely via Gcc-patches
Does anybody see a problem with this change? The point is to avoid unnecessary class template instantiations. Tested aarch64-linux. -- >8 -- For any typedef-name or template parameter, T, add_const_t is equivalent to T const, so we can avoid instantiating the std::add_const class template and ju

[committed] libstdc++: Remove workaround in __gnu_cxx::char_traits::move [PR89074]

2022-07-07 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux, pushed to trunk. -- >8 -- The front-end bug that prevented this constexpr loop from working has been fixed since GCC 12.1 so we can remove the workaround. libstdc++-v3/ChangeLog: PR c++/89074 * include/bits/char_traits.h (__gnu_cxx::char_traits::move):

Re: [PATCH] Inline memchr with a small constant string

2022-07-07 Thread H.J. Lu via Gcc-patches
On Thu, Jun 23, 2022 at 9:26 AM H.J. Lu wrote: > > On Wed, Jun 22, 2022 at 11:03 PM Richard Biener > wrote: > > > > On Wed, Jun 22, 2022 at 7:13 PM H.J. Lu wrote: > > > > > > On Wed, Jun 22, 2022 at 4:39 AM Richard Biener > > > wrote: > > > > > > > > On Tue, Jun 21, 2022 at 11:03 PM H.J. Lu via

[PATCH v2] Simplify memchr with small constant strings

2022-07-07 Thread H.J. Lu via Gcc-patches
When memchr is applied on a constant string of no more than the bytes of a word, simplify memchr by checking each byte in the constant string. int f (int a) { return __builtin_memchr ("AE", a, 2) != 0; } is simplified to int f (int a) { return ((char) a == 'A' || (char) a == 'E') != 0; }

[x86 PATCH] Support *testdi_not_doubleword during STV pass.

2022-07-07 Thread Roger Sayle
This patch fixes the current two FAILs of pr65105-5.c on x86 when compiled with -m32. These (temporary) breakages were fallout from my patches to improve/upgrade (scalar) double word comparisons. On mainline, the i386 backend currently represents a critical comparison using (compare (and (not reg

Re: [PATCH v2] tree-optimization/95821 - Convert strlen + strchr to memchr

2022-07-07 Thread Noah Goldstein via Gcc-patches
On Tue, Jun 21, 2022 at 11:13 AM Noah Goldstein wrote: > > On Tue, Jun 21, 2022 at 5:01 AM Jakub Jelinek wrote: > > > > On Mon, Jun 20, 2022 at 02:42:20PM -0700, Noah Goldstein wrote: > > > This patch allows for strchr(x, c) to the replace with memchr(x, c, > > > strlen(x) + 1) if strlen(x) has a

Re: [PATCH]middle-end simplify complex if expressions where comparisons are inverse of one another.

2022-07-07 Thread Jeff Law via Gcc-patches
On 7/5/2022 8:09 PM, Andrew Pinski via Gcc-patches wrote: Not your fault but there are now like two different predicates for a boolean like operand. zero_one_valued_p and truth_valued_p and a third way to describe it is to use SSA_NAME and check ssa_name_has_boolean_range. The latter is meant

[pushed] c++: -Woverloaded-virtual and dtors [PR87729]

2022-07-07 Thread Jason Merrill via Gcc-patches
My earlier patch broke out of the loop over base members when we found a match, but that caused trouble for dtors, which can have multiple for which same_signature_p is true. But as the function comment says, we know this doesn't apply to [cd]tors, so skip them. Tested x86_64-pc-linux-gnu, applyi

[PATCH v2] ipa-visibility: Optimize TLS access [PR99619]

2022-07-07 Thread Alexander Monakov via Gcc-patches
From: Artem Klimov Fix PR99619, which asks to optimize TLS model based on visibility. The fix is implemented as an IPA optimization: this allows to take optimized visibility status into account (as well as avoid modifying all language frontends). 2022-04-17 Artem Klimov gcc/ChangeLog:

Re: [PATCH] Add a heuristic for eliminate redundant load and store in inline pass.

2022-07-07 Thread Jan Hubicka via Gcc-patches
Hello, > From: Lili > > > Hi Hubicka, > > This patch is to add a heuristic inline hint to eliminate redundant load and > store. > > Bootstrap and regtest pending on x86_64-unknown-linux-gnu. > OK for trunk? > > Thanks, > Lili. > > Add a INLINE_HINT_eliminate_load_and_store hint in to inline

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-07 Thread Patrick Palka via Gcc-patches
On Thu, 7 Jul 2022, Jason Merrill wrote: > On 7/6/22 15:26, Patrick Palka wrote: > > On Tue, 5 Jul 2022, Jason Merrill wrote: > > > > > On 7/5/22 10:06, Patrick Palka wrote: > > > > On Fri, 1 Jul 2022, Jason Merrill wrote: > > > > > > > > > On 6/29/22 13:42, Patrick Palka wrote: > > > > > > In r

[RFA] Improve initialization of objects when the initializer has trailing zeros.

2022-07-07 Thread Jeff Law via Gcc-patches
This is an update to a patch originally posted by Takayuki Suwa a few months ago. When we initialize an array from a STRING_CST we perform the initialization in two steps.  The first step copies the STRING_CST to the destination.  The second step uses clear_storage to initialize storage in th

Re: [PATCH][RFC] More update-ssa speedup

2022-07-07 Thread Jeff Law via Gcc-patches
On 7/7/2022 7:33 AM, Richard Biener via Gcc-patches wrote: When we do TODO_update_ssa_no_phi we already avoid computing dominance frontiers for all blocks - it is worth to also avoid walking all dominated blocks in the update domwalk and restrict the walk to the SEME region with the affected b

[PATCH] match.pd: Add new bitwise arithmetic pattern [PR98304]

2022-07-07 Thread Sam Feifer via Gcc-patches
Hi! This patch is meant to solve a missed optimization in match.pd. It optimizes the following expression: n - (((n > 63) ? n : 63) & -64) where the constant being negated (in this case -64) is a power of 2 and the sum of the two constants is -1. For the signed case, this gets optimized to (n <

Re: Fix one issue in OpenMP 'requires' directive diagnostics (was: [Patch][v5] OpenMP: Move omp requires checks to libgomp)

2022-07-07 Thread Tobias Burnus
Hi Thomas, On 07.07.22 15:26, Thomas Schwinge wrote: On 2022-07-01T23:08:16+0200, Tobias Burnus wrote: Updated version attached – I hope I got everything right, but I start to get tired, I am not 100% sure. ..., and so the obligatory copy'n'past-o;-) crept in: ... + if (tm

Re: [GCC 13][PATCH] PR101836: Add a new option -fstrict-flex-array[=n] and use it in __builtin_object_size

2022-07-07 Thread Qing Zhao via Gcc-patches
> On Jul 7, 2022, at 4:02 AM, Richard Biener wrote: > > On Wed, Jul 6, 2022 at 4:20 PM Qing Zhao wrote: >> >> (Sorry for the late reply, just came back from a short vacation.) >> >>> On Jul 4, 2022, at 2:49 AM, Richard Biener >>> wrote: >>> >>> On Fri, Jul 1, 2022 at 5:32 PM Martin Sebor

[PATCH][RFC] More update-ssa speedup

2022-07-07 Thread Richard Biener via Gcc-patches
When we do TODO_update_ssa_no_phi we already avoid computing dominance frontiers for all blocks - it is worth to also avoid walking all dominated blocks in the update domwalk and restrict the walk to the SEME region with the affected blocks. We can do that by walking the CFG in reverse from blocks

Fix one issue in OpenMP 'requires' directive diagnostics (was: [Patch][v5] OpenMP: Move omp requires checks to libgomp)

2022-07-07 Thread Thomas Schwinge
Hi! On 2022-07-01T23:08:16+0200, Tobias Burnus wrote: > Updated version attached – I hope I got everything right, but I start to > get tired, I am not 100% sure. ..., and so the obligatory copy'n'past-o ;-) crept in: > --- a/gcc/lto-cgraph.cc > +++ b/gcc/lto-cgraph.cc > @@ -1773,6 +1804,10 @@

Re: [PATCH] lto-plugin: use locking only for selected targets

2022-07-07 Thread Martin Liška
On 7/7/22 13:46, Richard Biener wrote: > OK - that also resolves the mingw issue, correct? I suppose we need Yes. > to be careful to not advertise v1 API (which includes threadsafeness) > when not HAVE_PTHREAD_LOCKING. Will reflect that in the patch. I'm going to push it now. Martin

Re: [PATCH] lto-plugin: use locking only for selected targets

2022-07-07 Thread Martin Liška
On 7/7/22 13:52, Rainer Orth wrote: > Richard Biener via Gcc-patches writes: > >>> +if test x$use_locking = xyes; then >>> + AC_DEFINE(HAVE_PTHREAD_LOCKING, 1, >>> + [Define if the system-provided pthread locking mechanism.]) > > This isn't even a sentence. At least I cannot parse it

[PATCH] lto-dump: Do not print output file

2022-07-07 Thread Martin Liška
Right now the following is printed: lto-dump .file "" .ident "GCC: (GNU) 13.0.0 20220707 (experimental)" .section.note.GNU-stack,"",@progbits After the patch we print -help and do not emit any assembly output: lto-dump Usage: lt

Re: [PATCH v3] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero.

2022-07-07 Thread Lulu Cheng
在 2022/7/7 下午7:51, Xi Ruoyao 写道: On Thu, 2022-07-07 at 18:30 +0800, Lulu Cheng wrote: /* snip */ diff --git a/gcc/testsuite/gcc.target/loongarch/prolog-opt.c b/gcc/testsuite/gcc.target/loongarch/prolog-opt.c new file mode 100644 index 000..c7bd71dde93 --- /dev/null +++ b/gcc/testsui

Re: [PATCH 08/17] openmp: -foffload-memory=pinned

2022-07-07 Thread Tobias Burnus
Hi Andrew, On 07.07.22 12:34, Andrew Stubbs wrote: Implement the -foffload-memory=pinned option such that libgomp is instructed to enable fully-pinned memory at start-up. The option is intended to provide a performance boost to certain offload programs without modifying the code. ... gcc/Chan

Re: [PATCH] lto-plugin: use locking only for selected targets

2022-07-07 Thread Rainer Orth
Richard Biener via Gcc-patches writes: >> +if test x$use_locking = xyes; then >> + AC_DEFINE(HAVE_PTHREAD_LOCKING, 1, >> + [Define if the system-provided pthread locking mechanism.]) This isn't even a sentence. At least I cannot parse it. Besides, it seems to be misnamed since the t

Re: [PATCH v3] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero.

2022-07-07 Thread Xi Ruoyao via Gcc-patches
On Thu, 2022-07-07 at 18:30 +0800, Lulu Cheng wrote: /* snip */ > diff --git a/gcc/testsuite/gcc.target/loongarch/prolog-opt.c > b/gcc/testsuite/gcc.target/loongarch/prolog-opt.c > new file mode 100644 > index 000..c7bd71dde93 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/loongarch/pr

Re: [PATCH] lto-plugin: use locking only for selected targets

2022-07-07 Thread Richard Biener via Gcc-patches
On Thu, Jul 7, 2022 at 1:43 PM Martin Liška wrote: > > For now, support locking only for linux targets that are different from > riscv* where the target depends on libatomic (and fails during > bootstrap). > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be i

Re: [statistics.cc] ICE in get_function_name with fortran test-case

2022-07-07 Thread Richard Biener via Gcc-patches
On Thu, Jul 7, 2022 at 12:44 PM Prathamesh Kulkarni wrote: > > Hi, > My recent commit to emit asm name with -fdump-statistics-asmname > caused following ICE > for attached fortran test case. > > during IPA pass: icf > power.fppized.f90:6:26: > > 6 | END SUBROUTINE power_print > |

[PATCH] lto-plugin: use locking only for selected targets

2022-07-07 Thread Martin Liška
For now, support locking only for linux targets that are different from riscv* where the target depends on libatomic (and fails during bootstrap). Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin PR lto/106170 lto-plugin/Change

[PATCH] Speedup update-ssa some more

2022-07-07 Thread Richard Biener via Gcc-patches
The following avoids copying an sbitmap and one traversal by avoiding to re-allocate old_ssa_names when not necessary. In addition this actually checks what the comment before PHI insert iterating promises, that the old_ssa_names set does not grow. Bootstrapped on x86_64-unknown-linux-gnu, testin

Re: Fix Intel MIC 'mkoffload' for OpenMP 'requires' (was: [Patch] OpenMP: Move omp requires checks to libgomp)

2022-07-07 Thread Thomas Schwinge
Hi Tobias! On 2022-07-06T15:30:57+0200, Tobias Burnus wrote: > On 06.07.22 14:38, Thomas Schwinge wrote: >> :-) Haha, that's actually *exactly* what I had implemented first! But >> then I realized that 'target offloading_enabled' is doing exactly that: >> check that offloading compilation is con

[statistics.cc] ICE in get_function_name with fortran test-case

2022-07-07 Thread Prathamesh Kulkarni via Gcc-patches
Hi, My recent commit to emit asm name with -fdump-statistics-asmname caused following ICE for attached fortran test case. during IPA pass: icf power.fppized.f90:6:26: 6 | END SUBROUTINE power_print | ^ internal compiler error: Segmentation fault 0xfddc13 crash_s

Re: Enhance 'libgomp.c-c++-common/requires-4.c', 'libgomp.c-c++-common/requires-5.c' testing (was: [Patch][v4] OpenMP: Move omp requires checks to libgomp)

2022-07-07 Thread Thomas Schwinge
Hi Tobias! On 2022-07-07T11:36:34+0200, Tobias Burnus wrote: > On 07.07.22 10:42, Thomas Schwinge wrote: >> In preparation for other changes: > ... >> On 2022-06-29T16:33:02+0200, Tobias Burnus wrote: >>> +/* { dg-output "devices present but 'omp requires unified_address, >>> unified_shared_mem

[PATCH 16/17] amdgcn, openmp: Auto-detect USM mode and set HSA_XNACK

2022-07-07 Thread Andrew Stubbs
The AMD GCN runtime must be set to the correct mode for Unified Shared Memory to work, but this is not always clear at compile and link time due to the split nature of the offload compilation pipeline. This patch sets a new attribute on OpenMP offload functions to ensure that the information is p

[PATCH 15/17] amdgcn: Support XNACK mode

2022-07-07 Thread Andrew Stubbs
The XNACK feature allows memory load instructions to restart safely following a page-miss interrupt. This is useful for shared-memory devices, like APUs, and to implement OpenMP Unified Shared Memory. To support the feature we must be able to set the appropriate meta-data and set the load instru

[PATCH 17/17] amdgcn: libgomp plugin USM implementation

2022-07-07 Thread Andrew Stubbs
Implement the Unified Shared Memory API calls in the GCN plugin. The allocate and free are pretty straight-forward because all "target" memory allocations are compatible with USM, on the right hardware. However, there's no known way to check what memory region was used, after the fact, so we use

[PATCH 10/17] Add parsing support for allocate directive (OpenMP 5.0)

2022-07-07 Thread Andrew Stubbs
Currently we only make use of this directive when it is associated with an allocate statement. gcc/fortran/ChangeLog: * dump-parse-tree.cc (show_omp_node): Handle EXEC_OMP_ALLOCATE. (show_code_node): Likewise. * gfortran.h (enum gfc_statement): Add ST_OMP_ALLOCATE.

[PATCH 13/17] Gimplify allocate directive (OpenMP 5.0).

2022-07-07 Thread Andrew Stubbs
gcc/ChangeLog: * doc/gimple.texi: Describe GIMPLE_OMP_ALLOCATE. * gimple-pretty-print.cc (dump_gimple_omp_allocate): New function. (pp_gimple_stmt_1): Call it. * gimple.cc (gimple_build_omp_allocate): New function. * gimple.def (GIMPLE_OMP_ALLOCATE): New no

[PATCH 08/17] openmp: -foffload-memory=pinned

2022-07-07 Thread Andrew Stubbs
Implement the -foffload-memory=pinned option such that libgomp is instructed to enable fully-pinned memory at start-up. The option is intended to provide a performance boost to certain offload programs without modifying the code. This feature only works on Linux, at present, and simply calls mlo

[PATCH 14/17] Lower allocate directive (OpenMP 5.0).

2022-07-07 Thread Andrew Stubbs
This patch looks for malloc/free calls that were generated by allocate statement that is associated with allocate directive and replaces them with GOMP_alloc and GOMP_free. gcc/ChangeLog: * omp-low.cc (scan_sharing_clauses): Handle OMP_CLAUSE_ALLOCATOR. (scan_omp_allocate): New.

[PATCH 11/17] Translate allocate directive (OpenMP 5.0).

2022-07-07 Thread Andrew Stubbs
gcc/fortran/ChangeLog: * trans-openmp.cc (gfc_trans_omp_clauses): Handle OMP_LIST_ALLOCATOR. (gfc_trans_omp_allocate): New function. (gfc_trans_omp_directive): Handle EXEC_OMP_ALLOCATE. gcc/ChangeLog: * tree-pretty-print.cc (dump_omp_clause): Handle OMP_CLAUSE_AL

[PATCH 07/17] openmp: allow requires unified_shared_memory

2022-07-07 Thread Andrew Stubbs
This is the front-end portion of the Unified Shared Memory implementation. It removes the "sorry, unimplemented message" in C, C++, and Fortran, and sets flag_offload_memory, but is otherwise inactive, for now. It also checks that -foffload-memory isn't set to an incompatible mode. gcc/c/ChangeL

[PATCH 12/17] Handle cleanup of omp allocated variables (OpenMP 5.0).

2022-07-07 Thread Andrew Stubbs
Currently we are only handling omp allocate directive that is associated with an allocate statement. This statement results in malloc and free calls. The malloc calls are easy to get to as they are in the same block as allocate directive. But the free calls come in a separate cleanup block. To

[PATCH 05/17] openmp, nvptx: ompx_unified_shared_mem_alloc

2022-07-07 Thread Andrew Stubbs
This adds support for using Cuda Managed Memory with omp_alloc. It will be used as the underpinnings for "requires unified_shared_memory" in a later patch. There are two new predefined allocators, ompx_unified_shared_mem_alloc and ompx_host_mem_alloc, plus corresponding memory spaces, which can

[PATCH 06/17] openmp: Add -foffload-memory

2022-07-07 Thread Andrew Stubbs
Add a new option. It's inactive until I add some follow-up patches. gcc/ChangeLog: * common.opt: Add -foffload-memory and its enum values. * coretypes.h (enum offload_memory): New. * doc/invoke.texi: Document -foffload-memory. --- gcc/common.opt | 16 ++

[PATCH 09/17] openmp: Use libgomp memory allocation functions with unified shared memory.

2022-07-07 Thread Andrew Stubbs
This patches changes calls to malloc/free/calloc/realloc and operator new to memory allocation functions in libgomp with allocator=ompx_unified_shared_mem_alloc. This helps existing code to benefit from the unified shared memory. The libgomp does the correct thing with all the mapping constructs

[PATCH 03/17] libgomp, openmp: Add ompx_pinned_mem_alloc

2022-07-07 Thread Andrew Stubbs
This creates a new predefined allocator as a shortcut for using pinned memory with OpenMP. The name uses the OpenMP extension space and is intended to be consistent with other OpenMP implementations currently in development. The allocator is equivalent to using a custom allocator with the pinned

[PATCH 04/17] openmp, nvptx: low-lat memory access traits

2022-07-07 Thread Andrew Stubbs
The NVPTX low latency memory is not accessible outside the team that allocates it, and therefore should be unavailable for allocators with the access trait "all". This change means that the omp_low_lat_mem_alloc predefined allocator now implicitly implies the "pteam" trait. libgomp/ChangeLog:

[PATCH 01/17] libgomp, nvptx: low-latency memory allocator

2022-07-07 Thread Andrew Stubbs
This patch adds support for allocating low-latency ".shared" memory on NVPTX GPU device, via the omp_low_lat_mem_space and omp_alloc. The memory can be allocated, reallocated, and freed using a basic but fast algorithm, is thread safe and the size of the low-latency heap can be configured using t

[PATCH 02/17] libgomp: pinned memory

2022-07-07 Thread Andrew Stubbs
Implement the OpenMP pinned memory trait on Linux hosts using the mlock syscall. Pinned allocations are performed using mmap, not malloc, to ensure that they can be unpinned safely when freed. libgomp/ChangeLog: * allocator.c (MEMSPACE_ALLOC): Add PIN. (MEMSPACE_CALLOC): Add PIN

[PATCH 00/17] openmp, nvptx, amdgcn: 5.0 Memory Allocators

2022-07-07 Thread Andrew Stubbs
This patch series implements OpenMP allocators for low-latency memory on nvptx, unified shared memory on both nvptx and amdgcn, and generic pinned memory support for all Linux hosts (an nvptx-specific implementation using Cuda pinned memory is planned for the future, as is low-latency memory on amd

[PATCH v3] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero.

2022-07-07 Thread Lulu Cheng
update testsuite. -- Under the LA architecture, when the stack is dropped too far, the process of dropping the stack is divided into two steps. step1: After dropping the stack, save callee saved registers on the stack. step2: The rest of it. The stack drop operation is op

[PATCH v2] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero.

2022-07-07 Thread Lulu Cheng
Under the LA architecture, when the stack is dropped too far, the process of dropping the stack is divided into two steps. step1: After dropping the stack, save callee saved registers on the stack. step2: The rest of it. The stack drop operation is optimized when frame->total_size minus frame->sp_

Re: Enhance 'libgomp.c-c++-common/requires-4.c', 'libgomp.c-c++-common/requires-5.c' testing (was: [Patch][v4] OpenMP: Move omp requires checks to libgomp)

2022-07-07 Thread Tobias Burnus
On 07.07.22 10:42, Thomas Schwinge wrote: In preparation for other changes: ... On 2022-06-29T16:33:02+0200, Tobias Burnus wrote: +/* { dg-output "devices present but 'omp requires unified_address, unified_shared_memory, reverse_offload' cannot be fulfilled" } */ (The latter diagnostic late

Re: libstdc++: Minor codegen improvement for atomic wait spinloop

2022-07-07 Thread Jonathan Wakely via Gcc-patches
On Wed, 6 Jul 2022 at 22:42, Thomas Rodgers wrote: > > Ok for trunk? backport? Yes, for all branches that have the atomic wait code. > > On Wed, Jul 6, 2022 at 1:56 PM Jonathan Wakely wrote: >> >> On Wed, 6 Jul 2022 at 02:05, Thomas Rodgers via Libstdc++ >> wrote: >> > >> > This patch merges

Re: [PATCH] rs6000: Preserve REG_EH_REGION when replacing load/store [PR106091]

2022-07-07 Thread Kewen.Lin via Gcc-patches
on 2022/7/7 17:03, Richard Biener wrote: > On Thu, Jul 7, 2022 at 10:55 AM Kewen.Lin wrote: >> >> Hi, >> >> As test case in PR106091 shows, rs6000 specific pass swaps >> doesn't preserve the reg_note REG_EH_REGION when replacing >> some load insn at the end of basic block, it causes the >> flow in

Re: [PATCH] rs6000: Preserve REG_EH_REGION when replacing load/store [PR106091]

2022-07-07 Thread Richard Biener via Gcc-patches
On Thu, Jul 7, 2022 at 10:55 AM Kewen.Lin wrote: > > Hi, > > As test case in PR106091 shows, rs6000 specific pass swaps > doesn't preserve the reg_note REG_EH_REGION when replacing > some load insn at the end of basic block, it causes the > flow info verification to fail unexpectedly. Since memor

Re: Adjust 'libgomp.c-c++-common/requires-3.c' (was: [Patch][v4] OpenMP: Move omp requires checks to libgomp)

2022-07-07 Thread Tobias Burnus
Hi Thomas, hello all, On 07.07.22 10:37, Thomas Schwinge wrote: In preparation for other changes: On 2022-06-29T16:33:02+0200, Tobias Burnus wrote: +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-3.c @@ -0,0 +1,24 @@ +/* { dg-do link { target offloading_enabled } } */ Not expected to s

Re: [PATCH] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero.

2022-07-07 Thread Xi Ruoyao via Gcc-patches
On Thu, 2022-07-07 at 16:31 +0800, WANG Xuerui wrote: > IMO it's better to also state which problem this change is meant to > solve (i.e. your intent), better yet, with an appropriate bugzilla > link. And/or add a testcase (which FAILs without this change) into gcc/testsuite/gcc.target/loongarch

[PATCH] rs6000: Preserve REG_EH_REGION when replacing load/store [PR106091]

2022-07-07 Thread Kewen.Lin via Gcc-patches
Hi, As test case in PR106091 shows, rs6000 specific pass swaps doesn't preserve the reg_note REG_EH_REGION when replacing some load insn at the end of basic block, it causes the flow info verification to fail unexpectedly. Since memory reference rtx may trap, this patch is to ensure we copy REG_

[PATCH 2/2] RISC-V: Support zfh and zfhmin extension

2022-07-07 Thread Kito Cheng
Zfh and Zfhmin are extensions for IEEE half precision, both are ratified in Jan. 2022[1]: - Zfh has full set of operation like F or D for single or double precision. - Zfhmin has only provide minimal support for half precision operation, like conversion, load, store and move instructions. [1]

[PATCH 1/2] RISC-V: Support _Float16 type.

2022-07-07 Thread Kito Cheng
RISC-V decide use _Float16 as primary IEEE half precision type, and this already become part of psABI, this patch has added folloing support for _Float16: - Soft-float support for _Float16. - Make sure _Float16 available on C++ mode. - Name mangling for _Float16 on C++ mode. gcc/ChangeLog

[PATCH 0/0] RISC-V: Support IEEE half precision operation

2022-07-07 Thread Kito Cheng
This patch set implement _Float16 both for softfloat and hardfloat (zfh/zfhmin), _Float16 has introduced into RISC-V psABI[1] since Jul 2021 and zfh/zfhmin extension has ratified since 2022[2]. [1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/172 [2] https://github.com/riscv/riscv-is

[PATCH] target/106219 - proprly mark builtins pure via ix86_add_new_builtins

2022-07-07 Thread Richard Biener via Gcc-patches
The target optimize pragma path to initialize extra target specific builtins missed handling of the pure_p flag which in turn causes extra clobber side-effects of gather builtins leading to unexpected issues downhill. Bootstrap and regtest running on x86_64-unknown-linux-gnu, will push as obvious

[PATCH] Speed up LC SSA rewrite more

2022-07-07 Thread Richard Biener via Gcc-patches
In many cases loops have only one exit or a variable is only live across one of the exits. In this case we know that all uses outside of the loop will be dominated by the single LC PHI node we insert. If that holds for all variables requiring LC SSA PHIs then we can simplify the update_ssa proces

Enhance 'libgomp.c-c++-common/requires-4.c', 'libgomp.c-c++-common/requires-5.c' testing (was: [Patch][v4] OpenMP: Move omp requires checks to libgomp)

2022-07-07 Thread Thomas Schwinge
Hi! In preparation for other changes: On 2022-06-29T16:33:02+0200, Tobias Burnus wrote: > --- /dev/null > +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-4-aux.c > @@ -0,0 +1,13 @@ > +/* { dg-skip-if "" { *-*-* } } */ > + > +#pragma omp requires reverse_offload > + > +/* Note: The file doe

Adjust 'libgomp.c-c++-common/requires-3.c' (was: [Patch][v4] OpenMP: Move omp requires checks to libgomp)

2022-07-07 Thread Thomas Schwinge
Hi! In preparation for other changes: On 2022-06-29T16:33:02+0200, Tobias Burnus wrote: > --- /dev/null > +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-3-aux.c > @@ -0,0 +1,11 @@ > +/* { dg-skip-if "" { *-*-* } } */ > + > +#pragma omp requires unified_address > + > +int x; > + > +void fo

Re: [PATCH] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero.

2022-07-07 Thread WANG Xuerui
Hi, On 2022/7/7 16:04, Lulu Cheng wrote: gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_compute_frame_info): Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero, don't minus UNITS_PER_WORD or UNITS_PER_FP

[PATCH v2] Modify combine pattern by a pseudo AND with its nonzero bits [PR93453]

2022-07-07 Thread HAO CHEN GUI via Gcc-patches
Hi, This patch modifies the combine pattern after recog fails. With a helper - change_pseudo_and_mask, it converts a single pseudo to the pseudo AND with a mask when the outer operator is IOR/XOR/PLUS and inner operator is ASHIFT or AND. The conversion helps pattern to match rotate and mask insn

[PATCH] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero.

2022-07-07 Thread Lulu Cheng
gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_compute_frame_info): Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero, don't minus UNITS_PER_WORD or UNITS_PER_FP_REG. --- gcc/config/loongarch/loongarch.cc

Re: [GCC 13][PATCH] PR101836: Add a new option -fstrict-flex-array[=n] and use it in __builtin_object_size

2022-07-07 Thread Richard Biener via Gcc-patches
On Wed, Jul 6, 2022 at 4:20 PM Qing Zhao wrote: > > (Sorry for the late reply, just came back from a short vacation.) > > > On Jul 4, 2022, at 2:49 AM, Richard Biener > > wrote: > > > > On Fri, Jul 1, 2022 at 5:32 PM Martin Sebor wrote: > >> > >> On 7/1/22 08:01, Qing Zhao wrote: > >>> > >>> >

  1   2   >