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

            Bug ID: 126899
           Summary: backward threader rejects  joiner-style threads on
                    statement count that DOM can thread
           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
            Blocks: 126010
  Target Milestone: ---

For the following testcase with -O2 -S joiner-cost.c
--param=dom-jump-threading=0 \
          -fdump-tree-threadfull1-details -fdump-tree-dom2-details

...

volatile int sink;

void f (int i, int *out)
{
   if (i)
     *out = 1;
   sink = 1;
   sink = 2;
   sink = 3;
   sink = 4;
   sink = 5;
   sink = 6;
   sink = 7;
   ink = 8;
   if (i)
    *out = 2;
}

threadfull1 finds and resolves the path, rejects on cost:
      Checking profitability of path (backwards):  bb:4 (10 insns) bb:2
      Control statement insns: 2
      Overall: 8 insns
      FAIL: Did not thread around loop and would copy too many statements.

But dom2 threads the identical paths, duplicating bb4:
      [1] Registering jump thread: (3, 4) incoming edge;  (4, 5) normal;
      [2] Registering jump thread: (2, 4) incoming edge;  (4, 6) normal;
      Removing basic block 4

With --param max-jump-thread-duplication-stmts=25, threadfull1 itself
registers both jump threads and dom2 has nothing to do, so it looks like
the problem here is the cost model.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126010
[Bug 126010] [meta-bug] Remove DOM

Reply via email to