public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/96457] New: PRE gets confused by punned load handling
@ 2020-08-04 11:44 rguenth at gcc dot gnu.org
  2020-08-04 11:44 ` [Bug tree-optimization/96457] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-04 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96457
           Summary: PRE gets confused by punned load handling
           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: ---

int flag;
union { double f; unsigned long long i; } u;
void foo();
unsigned long long i;
unsigned long long
test ()
{
  double f = 0.;
  if (flag)
    {
      foo ();
      f = u.f;
    }
  else
    i = u.i;
  f = u.f + f;
  return f;
}

here we fail to PRE the load of u.f because PHI translation to the else
path fails since we run into

            /* If we'd have to convert things we would need to validate
               if we can insert the translated expression.  So fail
               here for now - we cannot insert an alias with a different
               type in the VN tables either, as that would assert.  */
            if (result
                && !useless_type_conversion_p (ref->type, TREE_TYPE (result)))
              return NULL;

because we found a value for u.f there, that of u.i (because we value-number
them the same).  If one replaces 'i = u.i;' with 'foo ();' we appropriately
insert a load from u.f in the else path and remove the partial redundancy.

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

* [Bug tree-optimization/96457] PRE gets confused by punned load handling
  2020-08-04 11:44 [Bug tree-optimization/96457] New: PRE gets confused by punned load handling rguenth at gcc dot gnu.org
@ 2020-08-04 11:44 ` rguenth at gcc dot gnu.org
  2020-08-04 12:05 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-04 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|                            |missed-optimization
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2020-08-04

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

* [Bug tree-optimization/96457] PRE gets confused by punned load handling
  2020-08-04 11:44 [Bug tree-optimization/96457] New: PRE gets confused by punned load handling rguenth at gcc dot gnu.org
  2020-08-04 11:44 ` [Bug tree-optimization/96457] " rguenth at gcc dot gnu.org
@ 2020-08-04 12:05 ` rguenth at gcc dot gnu.org
  2021-05-18  7:06 ` rguenth at gcc dot gnu.org
  2021-07-28 20:28 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-04 12:05 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |88240

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
This also depends on a proper fix for PR88240.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88240
[Bug 88240] [8/9/10/11 Regression] Potential optimization bug: invalid pre-load
of floating-point value could cause SIGFPE-underflow if value is integer

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

* [Bug tree-optimization/96457] PRE gets confused by punned load handling
  2020-08-04 11:44 [Bug tree-optimization/96457] New: PRE gets confused by punned load handling rguenth at gcc dot gnu.org
  2020-08-04 11:44 ` [Bug tree-optimization/96457] " rguenth at gcc dot gnu.org
  2020-08-04 12:05 ` rguenth at gcc dot gnu.org
@ 2021-05-18  7:06 ` rguenth at gcc dot gnu.org
  2021-07-28 20:28 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-18  7:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96457
Bug 96457 depends on bug 88240, which changed state.

Bug 88240 Summary: [9 Regression] Potential optimization bug: invalid pre-load of floating-point value could cause SIGFPE-underflow if value is integer
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88240

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

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

* [Bug tree-optimization/96457] PRE gets confused by punned load handling
  2020-08-04 11:44 [Bug tree-optimization/96457] New: PRE gets confused by punned load handling rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-05-18  7:06 ` rguenth at gcc dot gnu.org
@ 2021-07-28 20:28 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-28 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
   Last reconfirmed|2020-08-04 00:00:00         |2021-7-28

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

end of thread, other threads:[~2021-07-28 20:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04 11:44 [Bug tree-optimization/96457] New: PRE gets confused by punned load handling rguenth at gcc dot gnu.org
2020-08-04 11:44 ` [Bug tree-optimization/96457] " rguenth at gcc dot gnu.org
2020-08-04 12:05 ` rguenth at gcc dot gnu.org
2021-05-18  7:06 ` rguenth at gcc dot gnu.org
2021-07-28 20:28 ` pinskia 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).