[PATCH] D108587: [MLGO] Make sure inliner logs when deleting callees
Mircea Trofin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 23 14:44:47 PDT 2021
mtrofin created this revision.
mtrofin added reviewers: jacobhegna, yundiqian.
Herald added subscribers: ChuanqiXu, hiraditya.
mtrofin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When using final reward (which is now the default), we were skipping
logging decisions that were leading to callee deletion. This fixes that.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D108587
Files:
llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
llvm/test/Transforms/Inline/ML/dev-mode-log-deleted.ll
Index: llvm/test/Transforms/Inline/ML/dev-mode-log-deleted.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/Inline/ML/dev-mode-log-deleted.ll
@@ -0,0 +1,32 @@
+; REQUIRES: have_tf_api
+; RUN: opt -enable-ml-inliner=development -passes=scc-oz-module-inliner \
+; RUN: -training-log=- -tfutils-text-log -S < %s | FileCheck %s
+
+define i32 @top() {
+ %a = call i32 @to_be_deleted()
+ %b = call i32 @externally_visible()
+ %ret = add i32 %a, %b
+ ret i32 %ret
+}
+
+define internal i32 @to_be_deleted() {
+ ret i32 1
+}
+
+define i32 @externally_visible() {
+ ret i32 2
+}
+
+; CHECK: key: "inlining_decision"
+; CHECK-NEXT: value {
+; CHECK-NEXT: feature {
+; CHECK-NEXT: int64_list {
+; CHECK-NEXT: value: 1
+; CHECK-NEXT: }
+; CHECK-NEXT: }
+; CHECK-NEXT: feature {
+; CHECK-NEXT: int64_list {
+; CHECK-NEXT: value: 1
+; CHECK-NEXT: }
+; CHECK-NEXT: }
+; CHECK-NEXT: }
\ No newline at end of file
Index: llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
===================================================================
--- llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
+++ llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
@@ -227,6 +227,8 @@
(*CallerSizeEstimateBefore + *CalleeSizeEstimateBefore);
getAdvisor()->updateNativeSizeEstimate(Reward);
log(Reward, /*Success=*/true);
+ } else {
+ log(NoReward, /*Success=*/true);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108587.368214.patch
Type: text/x-patch
Size: 1543 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210823/60f9f9d5/attachment.bin>
More information about the llvm-commits
mailing list