diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Transforms/IPO/SampleProfile.cpp | 3 | ||||
| -rw-r--r-- | llvm/test/Transforms/SampleProfile/summary.ll | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index 30eda6b109e..6a43f8dbac4 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -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; } diff --git a/llvm/test/Transforms/SampleProfile/summary.ll b/llvm/test/Transforms/SampleProfile/summary.ll index 49b1d2c3633..0a3d1a27648 100644 --- a/llvm/test/Transforms/SampleProfile/summary.ll +++ b/llvm/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: |

