[llvm] 2279380 - [Inliner] Don't skip inlining alwaysinline in optnone functions
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 7 13:02:57 PDT 2020
Author: Arthur Eubanks
Date: 2020-07-07T12:54:55-07:00
New Revision: 2279380eab08219911910e1ecdcef3eacb0b7f0c
URL: https://github.com/llvm/llvm-project/commit/2279380eab08219911910e1ecdcef3eacb0b7f0c
DIFF: https://github.com/llvm/llvm-project/commit/2279380eab08219911910e1ecdcef3eacb0b7f0c.diff
LOG: [Inliner] Don't skip inlining alwaysinline in optnone functions
Previously the NPM inliner would skip all potential inlines in an
optnone function, but alwaysinline callees should be inlined regardless
of optnone.
Fixes inline-optnone.ll under NPM.
Reviewed By: kazu
Differential Revision: https://reviews.llvm.org/D83021
Added:
Modified:
llvm/lib/Transforms/IPO/Inliner.cpp
llvm/test/Transforms/Inline/inline-optnone.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp
index 876ad8846a05..7d2260f4c169 100644
--- a/llvm/lib/Transforms/IPO/Inliner.cpp
+++ b/llvm/lib/Transforms/IPO/Inliner.cpp
@@ -791,7 +791,9 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
LazyCallGraph::Node &N = *CG.lookup(F);
if (CG.lookupSCC(N) != C)
continue;
- if (F.hasOptNone()) {
+ if (!Calls[I].first->getCalledFunction()->hasFnAttribute(
+ Attribute::AlwaysInline) &&
+ F.hasOptNone()) {
setInlineRemark(*Calls[I].first, "optnone attribute");
continue;
}
diff --git a/llvm/test/Transforms/Inline/inline-optnone.ll b/llvm/test/Transforms/Inline/inline-optnone.ll
index 9b99c4558ea0..475ef7692ce7 100644
--- a/llvm/test/Transforms/Inline/inline-optnone.ll
+++ b/llvm/test/Transforms/Inline/inline-optnone.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -inline -S | FileCheck %s
+; RUN: opt < %s --passes=inline -S | FileCheck %s
; Test that functions with attribute optnone are not inlined.
; Also test that only functions with attribute alwaysinline are
More information about the llvm-commits
mailing list