[PATCH] D83021: [Inliner] Don't skip inlining alwaysinline in optnone functions

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 21:39:09 PDT 2020


aeubanks updated this revision to Diff 275001.
aeubanks added a comment.

Remove unused import


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83021/new/

https://reviews.llvm.org/D83021

Files:
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Transforms/Inline/inline-optnone.ll


Index: llvm/test/Transforms/Inline/inline-optnone.ll
===================================================================
--- llvm/test/Transforms/Inline/inline-optnone.ll
+++ 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
Index: llvm/lib/Transforms/IPO/Inliner.cpp
===================================================================
--- llvm/lib/Transforms/IPO/Inliner.cpp
+++ llvm/lib/Transforms/IPO/Inliner.cpp
@@ -801,7 +801,9 @@
     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;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83021.275001.patch
Type: text/x-patch
Size: 1009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200702/6dfb6f1a/attachment.bin>


More information about the llvm-commits mailing list