[llvm] 41086f3 - [Attributor][NFC] Check for the Explorer first to avoid traversing uses

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 3 10:07:28 PDT 2023


Author: Johannes Doerfert
Date: 2023-07-03T10:07:03-07:00
New Revision: 41086f38ec68badfaea042ba98959023e45295c6

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

LOG: [Attributor][NFC] Check for the Explorer first to avoid traversing uses

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 35bf4ec9db5615..703a0e797e6408 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -613,17 +613,16 @@ static void followUsesInContext(AAType &AA, Attributor &A,
 template <class AAType, typename StateType = typename AAType::StateType>
 static void followUsesInMBEC(AAType &AA, Attributor &A, StateType &S,
                              Instruction &CtxI) {
+  MustBeExecutedContextExplorer *Explorer =
+      A.getInfoCache().getMustBeExecutedContextExplorer();
+  if (!Explorer)
+    return;
 
   // Container for (transitive) uses of the associated value.
   SetVector<const Use *> Uses;
   for (const Use &U : AA.getIRPosition().getAssociatedValue().uses())
     Uses.insert(&U);
 
-  MustBeExecutedContextExplorer *Explorer =
-      A.getInfoCache().getMustBeExecutedContextExplorer();
-  if (!Explorer)
-    return;
-
   followUsesInContext<AAType>(AA, A, *Explorer, &CtxI, Uses, S);
 
   if (S.isAtFixpoint())


        


More information about the llvm-commits mailing list