[Bug middle-end/126906] New: back threader does not thread unreachable edges but DOM does

"aldyh at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126906

            Bug ID: 126906
           Summary: back threader does not thread unreachable edges but
                    DOM does
           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, law at gcc dot gnu.org,
                    rguenth at gcc dot gnu.org
            Blocks: 126010
  Target Milestone: ---

See gcc.dg/builtin-unreachable-6a.c with --param=dom-jump-threading=0 added:

  void
  foo (int b, int c)
  {
    void *x = &&lab;
    if (b)
      {
  lab:
        __builtin_unreachable ();
      }
  lab2:
    if (c)
      x = &&lab2;
    goto *x;
  }

With the abnormal-PHI handling now upstream, the backward threader finds and
fully resolves the path, but profitable_path_p refuses it by design:
probably_never_executed_edge_p on the taken edge:

Checking profitability of path (backwards):
    FAIL: Jump-thread path not considered: path leads to probably
    never executed edge.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126010
[Bug 126010] [meta-bug] Remove DOM
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.