[llvm] 8a2e2a6 - [llvm] Fix refactoring bug introduced in D79042

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Thu May 14 16:07:35 PDT 2020


Author: Mircea Trofin
Date: 2020-05-14T15:59:43-07:00
New Revision: 8a2e2a6a2bd0ed9310a8739c256456567e2adb23

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

LOG: [llvm] Fix refactoring bug introduced in D79042

Incorrectly copied over the GetAssumptionCache snippet.

This patch also renames a variable for clarity.

Added: 
    

Modified: 
    llvm/lib/Analysis/InlineAdvisor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InlineAdvisor.cpp b/llvm/lib/Analysis/InlineAdvisor.cpp
index 2cc57d0f750b..16ab7598ee42 100644
--- a/llvm/lib/Analysis/InlineAdvisor.cpp
+++ b/llvm/lib/Analysis/InlineAdvisor.cpp
@@ -92,19 +92,19 @@ class DefaultInlineAdvice : public InlineAdvice {
 
 std::unique_ptr<InlineAdvice>
 DefaultInlineAdvisor::getAdvice(CallBase &CB, FunctionAnalysisManager &FAM) {
-  Function &Callee = *CB.getCalledFunction();
-  Function &F = *CB.getCaller();
-  ProfileSummaryInfo *PSI = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F)
-                                .getCachedResult<ProfileSummaryAnalysis>(
-                                    *CB.getParent()->getParent()->getParent());
+  Function &Caller = *CB.getCaller();
+  ProfileSummaryInfo *PSI =
+      FAM.getResult<ModuleAnalysisManagerFunctionProxy>(Caller)
+          .getCachedResult<ProfileSummaryAnalysis>(
+              *CB.getParent()->getParent()->getParent());
 
-  auto &ORE = FAM.getResult<OptimizationRemarkEmitterAnalysis>(F);
+  auto &ORE = FAM.getResult<OptimizationRemarkEmitterAnalysis>(Caller);
   // FIXME: make GetAssumptionCache's decl similar to the other 2 below. May
   // need changing the type of getInlineCost parameters? Also see similar case
   // in Inliner.cpp
   std::function<AssumptionCache &(Function &)> GetAssumptionCache =
       [&](Function &F) -> AssumptionCache & {
-    return FAM.getResult<AssumptionAnalysis>(Callee);
+    return FAM.getResult<AssumptionAnalysis>(F);
   };
   auto GetBFI = [&](Function &F) -> BlockFrequencyInfo & {
     return FAM.getResult<BlockFrequencyAnalysis>(F);


        


More information about the llvm-commits mailing list