[llvm] d504f7b - [Attributor][NFC] Hoist call out of a lambda

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 20:08:37 PDT 2020


Author: Johannes Doerfert
Date: 2020-10-27T22:07:54-05:00
New Revision: d504f7b91a937ba10e0b549ab8f1f5bb6c5c9a07

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

LOG: [Attributor][NFC] Hoist call out of a lambda

The call is not free, unsure if  this is needed but it does not make it
worse either.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index ac8e36d183df..1d516a71aba8 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -2576,6 +2576,7 @@ struct AANoAliasCallSiteArgument final : AANoAliasImpl {
     A.recordDependence(NoAliasAA, *this, DepClassTy::OPTIONAL);
 
     const IRPosition &VIRP = IRPosition::value(getAssociatedValue());
+    const Function *ScopeFn = VIRP.getAnchorScope();
     auto &NoCaptureAA =
         A.getAAFor<AANoCapture>(*this, VIRP, /* TrackDependence */ false);
     // Check whether the value is captured in the scope using AANoCapture.
@@ -2591,7 +2592,6 @@ struct AANoAliasCallSiteArgument final : AANoAliasImpl {
       if (UserI == getCtxI() && UserI->getNumOperands() == 1)
         return true;
 
-      const Function *ScopeFn = VIRP.getAnchorScope();
       if (ScopeFn) {
         const auto &ReachabilityAA =
             A.getAAFor<AAReachability>(*this, IRPosition::function(*ScopeFn));


        


More information about the llvm-commits mailing list