[llvm] r331709 - [NewPM] Emit inliner NoDefinition missed optimization remark
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Mon May 7 18:45:47 PDT 2018
Author: tejohnson
Date: Mon May 7 18:45:46 2018
New Revision: 331709
URL: http://llvm.org/viewvc/llvm-project?rev=331709&view=rev
Log:
[NewPM] Emit inliner NoDefinition missed optimization remark
Summary: Makes this consistent with the old PM.
Reviewers: eraman
Subscribers: mehdi_amini, llvm-commits
Differential Revision: https://reviews.llvm.org/D46526
Modified:
llvm/trunk/lib/Transforms/IPO/Inliner.cpp
llvm/trunk/test/Other/new-pm-defaults.ll
llvm/trunk/test/Other/new-pm-thinlto-defaults.ll
llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll
llvm/trunk/test/Transforms/Inline/optimization-remarks.ll
Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=331709&r1=331708&r2=331709&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Mon May 7 18:45:46 2018
@@ -830,8 +830,14 @@ PreservedAnalyses InlinerPass::run(LazyC
// incrementally maknig a single function grow in a super linear fashion.
SmallVector<std::pair<CallSite, int>, 16> Calls;
+ FunctionAnalysisManager &FAM =
+ AM.getResult<FunctionAnalysisManagerCGSCCProxy>(InitialC, CG)
+ .getManager();
+
// Populate the initial list of calls in this SCC.
for (auto &N : InitialC) {
+ auto &ORE =
+ FAM.getResult<OptimizationRemarkEmitterAnalysis>(N.getFunction());
// We want to generally process call sites top-down in order for
// simplifications stemming from replacing the call with the returned value
// after inlining to be visible to subsequent inlining decisions.
@@ -839,9 +845,20 @@ PreservedAnalyses InlinerPass::run(LazyC
// Instead we should do an actual RPO walk of the function body.
for (Instruction &I : instructions(N.getFunction()))
if (auto CS = CallSite(&I))
- if (Function *Callee = CS.getCalledFunction())
+ if (Function *Callee = CS.getCalledFunction()) {
if (!Callee->isDeclaration())
Calls.push_back({CS, -1});
+ else if (!isa<IntrinsicInst>(I)) {
+ using namespace ore;
+ ORE.emit([&]() {
+ return OptimizationRemarkMissed(DEBUG_TYPE, "NoDefinition", &I)
+ << NV("Callee", Callee) << " will not be inlined into "
+ << NV("Caller", CS.getCaller())
+ << " because its definition is unavailable"
+ << setIsVerbose();
+ });
+ }
+ }
}
if (Calls.empty())
return PreservedAnalyses::all();
Modified: llvm/trunk/test/Other/new-pm-defaults.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/new-pm-defaults.ll?rev=331709&r1=331708&r2=331709&view=diff
==============================================================================
--- llvm/trunk/test/Other/new-pm-defaults.ll (original)
+++ llvm/trunk/test/Other/new-pm-defaults.ll Mon May 7 18:45:46 2018
@@ -113,8 +113,8 @@
; CHECK-O-NEXT: Starting CGSCC pass manager run.
; CHECK-O-NEXT: Running pass: InlinerPass
; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph{{.*}}>
-; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
+; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
; CHECK-O-NEXT: Running pass: CGSCCToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
; CHECK-O-NEXT: Starting llvm::Function pass manager run.
Modified: llvm/trunk/test/Other/new-pm-thinlto-defaults.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/new-pm-thinlto-defaults.ll?rev=331709&r1=331708&r2=331709&view=diff
==============================================================================
--- llvm/trunk/test/Other/new-pm-thinlto-defaults.ll (original)
+++ llvm/trunk/test/Other/new-pm-thinlto-defaults.ll Mon May 7 18:45:46 2018
@@ -98,8 +98,8 @@
; CHECK-O-NEXT: Starting CGSCC pass manager run.
; CHECK-O-NEXT: Running pass: InlinerPass
; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph{{.*}}>
-; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
+; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
; CHECK-O-NEXT: Running pass: CGSCCToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
; CHECK-O-NEXT: Starting llvm::Function pass manager run.
Modified: llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll?rev=331709&r1=331708&r2=331709&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll (original)
+++ llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll Mon May 7 18:45:46 2018
@@ -20,10 +20,10 @@
; NewPM:
; RUN: opt < %s -S -passes=inline -pass-remarks-missed=inline \
; RUN: -pass-remarks-with-hotness -pass-remarks-hotness-threshold 15 \
-; RUN: -pass-remarks-output=%t 2>&1 | FileCheck %s -check-prefix=CHECK_NEW
-; RUN: test ! -s %t
+; RUN: -pass-remarks-output=%t 2>&1 | FileCheck %s
+; RUN: cat %t | FileCheck -check-prefix=YAML %s
; RUN: opt < %s -S -passes=inline -pass-remarks-with-hotness -pass-remarks-output=%t
-; RUN: test ! -s %t
+; RUN: cat %t | FileCheck -check-prefix=YAML %s
;
; Verify that remarks that don't meet the hotness threshold are not output.
; RUN: opt < %s -S -passes=inline -pass-remarks-missed=inline \
@@ -79,9 +79,6 @@
; No remarks should be output, since none meet the threshold.
; THRESHOLD-NOT: remark
-; NewPM does not output this kind of "missed" remark.
-; CHECK_NEW-NOT: remark
-
; ModuleID = '/tmp/s.c'
source_filename = "/tmp/s.c"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
Modified: llvm/trunk/test/Transforms/Inline/optimization-remarks.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/optimization-remarks.ll?rev=331709&r1=331708&r2=331709&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/optimization-remarks.ll (original)
+++ llvm/trunk/test/Transforms/Inline/optimization-remarks.ll Mon May 7 18:45:46 2018
@@ -10,12 +10,10 @@
; RUN: FileCheck -check-prefix=CHECK -check-prefix=NO_HOTNESS %s
; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
-; RUN: FileCheck -check-prefix=CHECK -check-prefix=HOTNESS_NEW %s
+; RUN: FileCheck -check-prefix=CHECK -check-prefix=HOTNESS %s
; HOTNESS: fox will not be inlined into bar because its definition is unavailable
; NO_HOTNESS-NOT: fox will not be inlined into bar because its definition is unavailable
-; NewPM's inliner does not emit the following remark:
-; HOTNESS_NEW-NOT: fox will not be inlined into bar because its definition is unavailable
; CHECK: foo inlined into bar with cost=always
; CHECK: foz not inlined into bar because it should never be inlined (cost=never)
More information about the llvm-commits
mailing list