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

            Bug ID: 126222
           Summary: ranger: threading path containing pointer inequality
                    to resolved
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aldyh at gcc dot gnu.org
                CC: amacleod at redhat dot com
        Depends on: 125986
            Blocks: 126010
  Target Milestone: ---

[Reproduce with -O2 -fdump-tree-dom-all.  I am attaching the .ii file.]

For diagnostics/sarif-sink.ii, distilled from a stage1 bootstrap, the DOM
tables are resolving a conditional on a path which ranger cannot.  I am
attaching a couple patches to reproduce this (the same as I did for PR126212).

With these we ICE while trying to unsuccesfully fold (DOM resolves it to true):

if (search$_M_node_151 != &MEM[(struct _Rb_tree *)&arr +
40B]._M_impl.D.319560._M_header)

The threading candidate path is BB18->BB20.

BB13:
        if (__y_177 == &MEM[(struct _Rb_tree *)&arr +
40B]._M_impl.D.319560._M_header)
           blah
        else
           goto bb15

...
... (BB15 dominates BB18)
...

BB18:
        ;; __y_177 != &MEM[....] is known on entry
        if (_182 < 0)
           blah
        else
           goto bb20

BB20:
        cstore_554 = PHI <&MEM[(struct _Rb_tree *)&arr +
40B]._M_impl.D.319560._M_header(5), __y_177(18)>
        SR.5218_179 = cstore_554
        SR.5216_178 = SR.5218_179
        search$_M_node_151 = SR.5216_178
        ;;
        ;; After the above copies, this amounts to __y_177 != &MEM[...]
        ;; VVVVVVV
        if (search$_M_node_151 != &MEM[(struct _Rb_tree *)&arr +
40B]._M_impl.D.319560._M_header)

So clearly we should know how to fold the final conditional in this path.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125986
[Bug 125986] ranger: incoming relations to a threading path are ignored
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126010
[Bug 126010] [meta-bug] Remove DOM

Reply via email to