[Attributor][NFC] Hoist call out of a lambda
authorJohannes Doerfert <johannes@jdoerfert.de>
Sat, 10 Oct 2020 14:41:18 +0000 (09:41 -0500)
committerJohannes Doerfert <johannes@jdoerfert.de>
Wed, 28 Oct 2020 03:07:54 +0000 (22:07 -0500)
The call is not free, unsure if  this is needed but it does not make it
worse either.

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

index ac8e36d..1d516a7 100644 (file)
@@ -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));