If a call site is dominated by an OR condition and if any of its arguments are predicated on this OR condition, see if splitting the condition (and thereby further constraining the arguments) increases our opportunities to inline the call.
For example, in the code below, if callee() is not inlinable, we try to split the call site since we can predicate the argument (ptr) based on the OR condition. Inline if any of the new call sites is inlinable.
Split the OR condition from :
char *ptr = foo(); bool cond = bar(); if (!ptr || cond) callee(ptr);
to:
if (!ptr) callee(null) // pass null because ptr is known constant null else if (cond) callee(nonnull ptr) // set the nonnull attribute on the ptr argument
, if the inline cost for either callee(null) or callee(nonnull %ptr) is less than threshold.
This is WIP and needs more test cases, but I'm submitting to get an early high level feedback about its approach.
I found 20% performance improvement in spec2017/gcc without regression in my spec2000/2006/2017 tests on aarch64.