public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <idsandoe@googlemail.com>
To: Richard Biener <rguenther@suse.de>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] tree-optimization/105679 - disable backward threading of unlikely entry
Date: Mon, 1 Aug 2022 09:33:04 +0100	[thread overview]
Message-ID: <F62BCA9E-137D-41F6-8BDE-6A34E602FC8E@googlemail.com> (raw)
In-Reply-To: <nycvar.YFH.7.77.849.2208010819411.4208@jbgna.fhfr.qr>



> On 1 Aug 2022, at 09:21, Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
> On Sun, 31 Jul 2022, Iain Sandoe wrote:
> 
>> Hi Richi,
>> 
>>> On 29 Jul 2022, at 09:54, Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>>> 
>>> The following makes the backward threader reject threads whose entry
>>> edge is probably never executed according to the profile.  That in
>>> particular, for the testcase, avoids threading the irq == 1 check
>>> on the path where irq > 31, thereby avoiding spurious -Warray-bounds
>>> diagnostics
>> 
>> This breaks bootstrap on i686-darwin{9,17} with what looks like a valid  warning (werrors on stage2)
>> 
>> cc1plus  … -O2 -Wall … is enough to.
>> 
>> I can repeat it on a cross from x86_64-darwin19, so I can probably reduce the .ii (it’s like 2M5 raw) and file a PR if you like - depends if the solution might be obvious to you …
> 
> Can you open a bugreport and attach full preprocessed source at start?

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106496

> Note at the start of the function we have
> 
>  if (m_path.length () <= 1)
>      return false;
> 
> so
> 
>      edge entry = find_edge (m_path[m_path.length () - 1],
>                              m_path[m_path.length () - 2]);
> 
> is known to not access m_path out-of-bounds ...

yes, I saw that .. so I guess somehow that information is getting dropped.
thanks
Iain

> 
> Thanks,
> Richard.
> 
>> 
>> thanks
>> Iain
>> 
>> --------
>> 
>> In file included from /src-local/gcc-master/gcc/hash-table.h:248,
>>                 from /src-local/gcc-master/gcc/coretypes.h:486,
>>                 from /src-local/gcc-master/gcc/tree-ssa-threadbackward.cc:22:
>> In member function ‘T& vec<T, A, vl_embed>::operator[](unsigned int) [with T = basic_block_def*; A = va_heap]’,
>>    inlined from ‘const T& vec<T>::operator[](unsigned int) const [with T = basic_block_def*]’ at /src-local/gcc-master/gcc/vec.h:1486:20,
>>    inlined from ‘bool back_threader_profitability::profitable_path_p(const vec<basic_block_def*>&, tree, edge, bool*)’ at /src-local/gcc-master/gcc/tree-ssa-threadbackward.cc:781:37:
>> /src-local/gcc-master/gcc/vec.h:890:19: warning: array subscript 4294967294 is above array bounds of ‘basic_block_def* [1]’ [-Warray-bounds]
>>  890 |   return m_vecdata[ix];
>>      |          ~~~~~~~~~^
>> /src-local/gcc-master/gcc/vec.h: In member function ‘bool back_threader_profitability::profitable_path_p(const vec<basic_block_def*>&, tree, edge, bool*)’:
>> /src-local/gcc-master/gcc/vec.h:635:5: note: while referencing ‘vec<basic_block_def*, va_heap, vl_embed>::m_vecdata’
>>  635 |   T m_vecdata[1];
>>      |     ^~~~~~~~~
>> 
>> =====
> 
> -- 
> Richard Biener <rguenther@suse.de>
> SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
> Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
> HRB 36809 (AG Nuernberg)


      reply	other threads:[~2022-08-01  8:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29  8:54 Richard Biener
2022-07-29 11:43 ` Aldy Hernandez
2022-07-29 12:21   ` Richard Biener
2022-07-30 15:38 ` Jeff Law
2022-07-31 19:17 ` Iain Sandoe
2022-08-01  1:23   ` Jeff Law
2022-08-01  8:21   ` Richard Biener
2022-08-01  8:33     ` Iain Sandoe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F62BCA9E-137D-41F6-8BDE-6A34E602FC8E@googlemail.com \
    --to=idsandoe@googlemail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).