public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/95799] New: Assumed conjunctions are not broken down into clauses if their pureness is checked first
@ 2020-06-21  9:26 felix.von.s at posteo dot de
  2020-06-22  7:59 ` [Bug tree-optimization/95799] " felix.von.s at posteo dot de
  0 siblings, 1 reply; 2+ messages in thread
From: felix.von.s at posteo dot de @ 2020-06-21  9:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95799
           Summary: Assumed conjunctions are not broken down into clauses
                    if their pureness is checked first
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: felix.von.s at posteo dot de
  Target Milestone: ---

In the attached sample, foo is compiled into returning a constant 1, while bar
will compare a to 0, even though bar’s assumption implies foo’s.

If I replace __builtin_pure_p() testing with a constant 1, both functions
compile to the same assembly code, returning a constant 1. If I change bar to
return (a >= 0 && b >= 0), it also compiles to returning a constant 1.

It seems as if the optimiser becomes unaware that conjunction elimination is a
valid rule of inference if the conjunction’s pureness is checked first.

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

* [Bug tree-optimization/95799] Assumed conjunctions are not broken down into clauses if their pureness is checked first
  2020-06-21  9:26 [Bug tree-optimization/95799] New: Assumed conjunctions are not broken down into clauses if their pureness is checked first felix.von.s at posteo dot de
@ 2020-06-22  7:59 ` felix.von.s at posteo dot de
  0 siblings, 0 replies; 2+ messages in thread
From: felix.von.s at posteo dot de @ 2020-06-22  7:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from felix <felix.von.s at posteo dot de> ---
Created attachment 48767
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48767&action=edit
Sample program

I was pretty sure I attached this before. Never mind, here it is.

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

end of thread, other threads:[~2020-06-22  7:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-21  9:26 [Bug tree-optimization/95799] New: Assumed conjunctions are not broken down into clauses if their pureness is checked first felix.von.s at posteo dot de
2020-06-22  7:59 ` [Bug tree-optimization/95799] " felix.von.s at posteo dot de

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