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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |law at gcc dot gnu.org
   Target Milestone|12.5                        |16.0

--- Comment #5 from Jeffrey A. Law <law at gcc dot gnu.org> ---
So the key to this testcase is to remove the path leading to the m=1 statement.
 Once that statement is unreachable everything should just fall out.

This dump from thread2 should make it clear what needs to happen:

;;   basic block 3, loop depth 0
;;    pred:       2 
  _1 = p1_11(D) != 0;
  _2 = p2_12(D) != 0;
  _3 = _1 | _2;
  _33 = p5_13(D) != 0;
  _32 = _3 | _33;
  if (_32 != 0)   
    goto <bb 4>; [75.00%]
  else
    goto <bb 7>; [25.00%]
;;    succ:       4
;;                7

;;   basic block 4, loop depth 0
;;    pred:       3
  if (_3 != 0)
    goto <bb 7>; [50.00%]
  else
    goto <bb 5>; [50.00%]
;;    succ:       7
;;                5

;;   basic block 5, loop depth 0
;;    pred:       4
  if (p5_13(D) == 0)
    goto <bb 6>; [100.00%]
  else
    goto <bb 7>; [0.00%]
;;    succ:       6
;;                7

;;   basic block 6, loop depth 0
;;    pred:       5
  m = 1;
;;    succ:       7


WHen (_32 != 0) we traverse 3->4.  When we do that we know that either _3 or
_33 are nonzero.

To traverse 4->5 _3 must be zero , which implies that _33 was not zero. When
_33 is not zero, then we know that p5_13 is not zero.  That in turn would make
block #6 unreachable.

We have some code to derive equivalences, but it's designed more to walk up
through the defs to figure things out.  We also have the backprop code which
works through uses, but it's not going to track what happens on edges an
implied sets.

Feels like a DOM issue.  But not something suitable for addressing in gcc-15.

Reply via email to