[PATCH] D38641: [Inline][WIP] Try to inline if predicated on OR condition

Jun Bum Lim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 6 12:52:52 PDT 2017


junbuml created this revision.
Herald added subscribers: kristof.beyls, aemerson.

[Inline][WIP] Try to inline if predicated on OR condition

If a call site is dominated by an OR condition and if any of its arguments is
predicated based on the OR condition, try to split the call site, and see if the
new call sites with more  constrained arguments are turned into being inlinable.

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 :

  if (!ptr || c)
    callee(ptr);

to :

  if (!ptr)
    callee(nonnull ptr)  // set the nonnull attribute in the argument
  else if (c)
    callee(null)             // set the known constant value

, if the inline cost for either callee(nonnull %ptr) or func(null) is less then
threshold.

This is WIP and need 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.


https://reviews.llvm.org/D38641

Files:
  lib/Transforms/IPO/Inliner.cpp
  test/Transforms/Inline/inline-predicated-or.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38641.118056.patch
Type: text/x-patch
Size: 18023 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171006/d7af3877/attachment.bin>


More information about the llvm-commits mailing list