[llvm] 1be1fd7 - [AlwaysInliner] Check for callsite noinline attribute simplified

Dávid Bolvanský via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 00:33:50 PST 2022


Author: Dávid Bolvanský
Date: 2022-02-14T09:33:30+01:00
New Revision: 1be1fd735d5abd669453c0ebc5d5fa780ceeb9c9

URL: https://github.com/llvm/llvm-project/commit/1be1fd735d5abd669453c0ebc5d5fa780ceeb9c9
DIFF: https://github.com/llvm/llvm-project/commit/1be1fd735d5abd669453c0ebc5d5fa780ceeb9c9.diff

LOG: [AlwaysInliner] Check for callsite noinline attribute simplified

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/AlwaysInliner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/AlwaysInliner.cpp b/llvm/lib/Transforms/IPO/AlwaysInliner.cpp
index e6bccd97e0e78..00029fd70224c 100644
--- a/llvm/lib/Transforms/IPO/AlwaysInliner.cpp
+++ b/llvm/lib/Transforms/IPO/AlwaysInliner.cpp
@@ -59,16 +59,10 @@ PreservedAnalyses AlwaysInlinerPass::run(Module &M,
 
       for (User *U : F.users())
         if (auto *CB = dyn_cast<CallBase>(U))
-          if (CB->getCalledFunction() == &F) {
-            if (F.hasFnAttribute(Attribute::AlwaysInline)) {
-              // Avoid inlining if noinline call site attribute.
-              if (!CB->isNoInline())
-                Calls.insert(CB);
-            } else if (CB->hasFnAttr(Attribute::AlwaysInline)) {
-              // Ok, alwaysinline call site attribute.
+          if (CB->getCalledFunction() == &F &&
+                CB->hasFnAttr(Attribute::AlwaysInline) &&
+                !CB->getAttributes().hasFnAttr(Attribute::NoInline))
               Calls.insert(CB);
-            }
-          }
 
       for (CallBase *CB : Calls) {
         Function *Caller = CB->getCaller();


        


More information about the llvm-commits mailing list