forked from OSchip/llvm-project
Only sets profile summary when it was not preset.
Summary: 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. Reviewers: eraman, davidxl Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D27733 llvm-svn: 289725
This commit is contained in:
parent
fb699619a0
commit
40dd8c5109
|
@ -1315,7 +1315,8 @@ bool SampleProfileLoader::runOnModule(Module &M) {
|
|||
clearFunctionData();
|
||||
retval |= runOnFunction(F);
|
||||
}
|
||||
M.setProfileSummary(Reader->getSummary().getMD(M.getContext()));
|
||||
if (M.getProfileSummary() == nullptr)
|
||||
M.setProfileSummary(Reader->getSummary().getMD(M.getContext()));
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue