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

            Bug ID: 117632
           Summary: missed indirect to conditional direct call
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
static inline void yes(void) { __builtin_puts("yes"); }
static inline void no(void) { __builtin_puts("no"); }

void test(int v)
{
  (v ? yes : no)();
}
```

For the phi node (and right afterwards) we have:
```
  <bb 4> :
  # iftmp.0_2 = PHI <yes(2), no(3)>
  iftmp.0_2 ();
```

I suspect if we had this pattern, we should convert this into 2 direct function
calls in each bb (if the bb's only sucessor was bb 4).

Note there could be statements inbetween the phi and the call but nothing that
touches a virtual op though.

Reply via email to