[PATCH] D27733: Only sets profile summary when it was not preset.
Dehao Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 14:30:24 PST 2016
danielcdh created this revision.
danielcdh added reviewers: davidxl, eraman.
danielcdh added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.
SampleProfileLoader pass may be invoked twice by LTO. The 2nd pass should not append more summary info as it is already preset by the 1st pass.
https://reviews.llvm.org/D27733
Files:
lib/Transforms/IPO/SampleProfile.cpp
test/Transforms/SampleProfile/summary.ll
Index: test/Transforms/SampleProfile/summary.ll
===================================================================
--- test/Transforms/SampleProfile/summary.ll
+++ test/Transforms/SampleProfile/summary.ll
@@ -1,5 +1,6 @@
; Test that we annotate entire program's summary to IR.
; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/summary.prof -S | FileCheck %s
+; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/summary.prof -S | opt -sample-profile -sample-profile-file=%S/Inputs/summary.prof -S | FileCheck %s
define i32 @bar() #0 !dbg !1 {
entry:
Index: lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- lib/Transforms/IPO/SampleProfile.cpp
+++ lib/Transforms/IPO/SampleProfile.cpp
@@ -1315,7 +1315,8 @@
clearFunctionData();
retval |= runOnFunction(F);
}
- M.setProfileSummary(Reader->getSummary().getMD(M.getContext()));
+ if (M.getProfileSummary() == nullptr)
+ M.setProfileSummary(Reader->getSummary().getMD(M.getContext()));
return retval;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27733.81303.patch
Type: text/x-patch
Size: 1068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161213/f2a6f265/attachment.bin>
More information about the llvm-commits
mailing list