public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/96020] New: FRE uses not available def across EH edges
@ 2020-07-01 14:30 rguenth at gcc dot gnu.org
  2020-07-01 14:31 ` [Bug tree-optimization/96020] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-01 14:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96020
           Summary: FRE uses not available def across EH edges
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

I failed to distill a small testcase like

int *q;
int main()
{
  int *p = q;
  int a = 1;
  try {
    a = *p;
  } catch (...) {
    int b = *p;
    a += b;
  }
  __builtin_exit (a);
}

where a __cxa_begin_catch (_1); prevents CSE of the *p load across the EH
edge with -fnon-call-exceptions:

  <bb 2> :
  # VUSE <.MEM_4(D)>
  p_5 = q;
  # VUSE <.MEM_4(D)>
  _7 = *p_5;

  <bb 5> :
<L3>:
  # VUSE <.MEM_4(D)>
  _1 = __builtin_eh_pointer (1);
  # .MEM_9 = VDEF <.MEM_4(D)>
  __cxa_begin_catch (_1);
  # VUSE <.MEM_9>
  _10 = *p_5;

but for g++.dg/opt/pr92610.C and g++.dg/pr48633.C with for example -std=gnu++14
we can see it doing this:

  <bb 6> :
  _45 = MEM[(sizetype *)_28];

   <bb 18> :
 <L18>:
-  _51 = MEM[(sizetype *)_28];
-  _15 = _51 + 2;
+  _15 = _45 + 2;
   _16 = _15 * 4;
   operator delete [] (_28, _16);
   resx 5

thereby ICEing with a new SSA verification piece I coded after directing
Martin to only consider the fallthru edge as insert location for the SSA
defs of an internally throwing stmt.

DOM is probably susceptible to this, too.

I'm not sure how to trigger a real-world case that would exhibit breakage
(for the above we're removing another trap on the EH handler side).  A way
to trigger the odd IL seen for pr92610.C in a more controlled example
would be nice to have.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug tree-optimization/96020] FRE uses not available def across EH edges
  2020-07-01 14:30 [Bug tree-optimization/96020] New: FRE uses not available def across EH edges rguenth at gcc dot gnu.org
@ 2020-07-01 14:31 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-01 14:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 48819
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48819&action=edit
the verifier

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-01 14:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01 14:30 [Bug tree-optimization/96020] New: FRE uses not available def across EH edges rguenth at gcc dot gnu.org
2020-07-01 14:31 ` [Bug tree-optimization/96020] " rguenth at gcc dot gnu.org

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