public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/106754] New: compute_control_dep_chain over-estimates domain
@ 2022-08-26 11:33 rguenth at gcc dot gnu.org
  2022-09-06 12:56 ` [Bug tree-optimization/106754] " cvs-commit at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-26 11:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106754
           Summary: compute_control_dep_chain over-estimates domain
           Product: gcc
           Version: 13.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: ---

The following testcase shows compute_control_dep_chain for init_use_preds
of the 'return u' uninitialized use compute a path with w != 0 && v != 1,
leaving out the !(i < 10) loop exit predicate because of how the iteration
terminating condition on the post-dominator walk works.  While there's a
special case for the loop exit edge itself, the following if (y) z = 1;
intermediate post-dominator will still make the iteration terminate early
before reaching if (v != 1) and eventually the target block.  The parent
iteration which entered the loop will proceed to find that but the loop
exit condition will be lost.

extern unsigned bar (void);
extern void quux (void);
int z;
unsigned foo (unsigned v, int y, int w)
{
  unsigned u;
  if (v != 1)
    u = bar ();

  // This variantion from uninit-pred-11.c causes compute_control_dep_chain
  // to run into a defect, producing z != 0 && v != 1, omitting !(i<10)
  // from the path predicate
  if (w)
    {
      for (int i = 0; i < 10; i++)
        quux ();

      if (y)
        z = 1;
      if (v != 1)
        return u;
    }

  return 0;
}

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

* [Bug tree-optimization/106754] compute_control_dep_chain over-estimates domain
  2022-08-26 11:33 [Bug tree-optimization/106754] New: compute_control_dep_chain over-estimates domain rguenth at gcc dot gnu.org
@ 2022-09-06 12:56 ` cvs-commit at gcc dot gnu.org
  2022-09-06 12:56 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-06 12:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:0a4a2667dc115ca73b552fcabf8570620dfbe55f

commit r13-2500-g0a4a2667dc115ca73b552fcabf8570620dfbe55f
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Sep 6 13:46:00 2022 +0200

    tree-optimization/106754 - fix compute_control_dep_chain defect

    The following handles the situation of a loop exit along the
    control path to the PHI def or from there to the use in a different
    way, aoviding premature abort of the walks as noticed in the two
    cases where the exit is outermost (gcc.dg/uninit-pred-11.c) or
    wrapped in a condition that is on the path (gcc.dg/uninit-pred-12.c).
    Instead of handling such exits during recursion we now pick them
    up in the parent when walking post-dominators.  That requires an
    additional post-dominator walk at the outermost level which is
    facilitated by splitting out the walk to a helper function and
    the existing wrapper added earlier.

    The patch also removes the bogus early exit from
    uninit_analysis::init_use_preds, fixing a simplified version
    of the PR106155 testcase.

            PR tree-optimization/106754
            * gimple-predicate-analysis.cc (compute_control_dep_chain_pdom):
            New function, split out from compute_control_dep_chain.  Handle
            loop-exit like conditions here by pushing to the control vector.
            (compute_control_dep_chain): Adjust and streamline dumping.
            In the wrapper perform a post-dominator walk as well.
            (uninit_analysis::init_use_preds): Remove premature early exit.

            * gcc.dg/uninit-pred-12.c: New testcase.
            * gcc.dg/uninit-pr106155-1.c: Likewise.

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

* [Bug tree-optimization/106754] compute_control_dep_chain over-estimates domain
  2022-08-26 11:33 [Bug tree-optimization/106754] New: compute_control_dep_chain over-estimates domain rguenth at gcc dot gnu.org
  2022-09-06 12:56 ` [Bug tree-optimization/106754] " cvs-commit at gcc dot gnu.org
@ 2022-09-06 12:56 ` rguenth at gcc dot gnu.org
  2022-11-22 10:15 ` vincent-gcc at vinc17 dot net
  2022-11-28 22:36 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-09-06 12:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |13.0

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

* [Bug tree-optimization/106754] compute_control_dep_chain over-estimates domain
  2022-08-26 11:33 [Bug tree-optimization/106754] New: compute_control_dep_chain over-estimates domain rguenth at gcc dot gnu.org
  2022-09-06 12:56 ` [Bug tree-optimization/106754] " cvs-commit at gcc dot gnu.org
  2022-09-06 12:56 ` rguenth at gcc dot gnu.org
@ 2022-11-22 10:15 ` vincent-gcc at vinc17 dot net
  2022-11-28 22:36 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2022-11-22 10:15 UTC (permalink / raw)
  To: gcc-bugs

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

Vincent Lefèvre <vincent-gcc at vinc17 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vincent-gcc at vinc17 dot net

--- Comment #3 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to CVS Commits from comment #1)
>     The patch also removes the bogus early exit from
>     uninit_analysis::init_use_preds, fixing a simplified version
>     of the PR106155 testcase.

This commit also fixes the PR80548 testcase. However, I had built this testcase
from more complex code, for which GCC still warns. So I'll have to find another
simplified testcase for a new PR...

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

* [Bug tree-optimization/106754] compute_control_dep_chain over-estimates domain
  2022-08-26 11:33 [Bug tree-optimization/106754] New: compute_control_dep_chain over-estimates domain rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-11-22 10:15 ` vincent-gcc at vinc17 dot net
@ 2022-11-28 22:36 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-28 22:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

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

end of thread, other threads:[~2022-11-28 22:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26 11:33 [Bug tree-optimization/106754] New: compute_control_dep_chain over-estimates domain rguenth at gcc dot gnu.org
2022-09-06 12:56 ` [Bug tree-optimization/106754] " cvs-commit at gcc dot gnu.org
2022-09-06 12:56 ` rguenth at gcc dot gnu.org
2022-11-22 10:15 ` vincent-gcc at vinc17 dot net
2022-11-28 22:36 ` 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).