[Inliner] Inlining should honor nobuiltin attributes
authorTeresa Johnson <tejohnson@google.com>
Thu, 6 Feb 2020 21:28:41 +0000 (13:28 -0800)
committerTeresa Johnson <tejohnson@google.com>
Fri, 28 Feb 2020 15:34:14 +0000 (07:34 -0800)
commitf9ca75f19bab639988ebbe68c81d07babd952afb
treeba86feae04f86ea3ccf09470636f69fda9b3398d
parentb6e80864b6da7937504dcf5698ea49801d1f7be2
[Inliner] Inlining should honor nobuiltin attributes

Summary:
Final patch in series to fix inlining between functions with different
nobuiltin attributes/options, which was specifically an issue in LTO.
See discussion on D61634 for background.

The prior patch in this series (D67923) enabled per-Function TLI
construction that identified the nobuiltin attributes.

Here I have allowed inlining to proceed if the callee's nobuiltins are a
subset of the caller's nobuiltins, but not in the reverse case, which
should be conservatively correct. This is controlled by a new option,
-inline-caller-superset-nobuiltin, which is enabled by default.

Reviewers: hfinkel, gchatelet, chandlerc, davidxl

Subscribers: arsenm, jvesely, nhaehnle, mehdi_amini, eraman, hiraditya, haicheng, dexonsmith, kerbowa, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D74162
llvm/include/llvm/Analysis/InlineCost.h
llvm/include/llvm/Analysis/TargetLibraryInfo.h
llvm/include/llvm/Transforms/IPO/Inliner.h
llvm/lib/Analysis/InlineCost.cpp
llvm/lib/Target/AMDGPU/AMDGPUInline.cpp
llvm/lib/Transforms/IPO/InlineSimple.cpp
llvm/lib/Transforms/IPO/Inliner.cpp
llvm/lib/Transforms/IPO/PartialInlining.cpp
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/Inline/inline-no-builtin-compatible.ll [new file with mode: 0644]