[llvm] 1055c5e - [MLGO] Make sure inliner logs when deleting callees
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 23 14:54:56 PDT 2021
Author: Mircea Trofin
Date: 2021-08-23T14:54:46-07:00
New Revision: 1055c5e1d316164c70e0c9f016411a28f3b4792e
URL: https://github.com/llvm/llvm-project/commit/1055c5e1d316164c70e0c9f016411a28f3b4792e
DIFF: https://github.com/llvm/llvm-project/commit/1055c5e1d316164c70e0c9f016411a28f3b4792e.diff
LOG: [MLGO] Make sure inliner logs when deleting callees
When using final reward (which is now the default), we were skipping
logging decisions that were leading to callee deletion. This fixes that.
Differential Revision: https://reviews.llvm.org/D108587
Added:
llvm/test/Transforms/Inline/ML/dev-mode-log-deleted.ll
Modified:
llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp b/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
index e5e34dfc8327c..d87fa849d839a 100644
--- a/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
+++ b/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
@@ -227,6 +227,8 @@ class LoggingMLInlineAdvice : public MLInlineAdvice {
(*CallerSizeEstimateBefore + *CalleeSizeEstimateBefore);
getAdvisor()->updateNativeSizeEstimate(Reward);
log(Reward, /*Success=*/true);
+ } else {
+ log(NoReward, /*Success=*/true);
}
}
diff --git a/llvm/test/Transforms/Inline/ML/dev-mode-log-deleted.ll b/llvm/test/Transforms/Inline/ML/dev-mode-log-deleted.ll
new file mode 100644
index 0000000000000..3b6e56221e597
--- /dev/null
+++ b/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
More information about the llvm-commits
mailing list