[llvm] c1c9eb0 - [Transforms] Check validity of profile reader before invoking it
Yi Kong via llvm-commits
llvm-commits at lists.llvm.org
Tue May 26 05:12:17 PDT 2020
Author: Yi Kong
Date: 2020-05-26T20:11:24+08:00
New Revision: c1c9eb0ab7d20e61f0fb345a60694bda0487c0da
URL: https://github.com/llvm/llvm-project/commit/c1c9eb0ab7d20e61f0fb345a60694bda0487c0da
DIFF: https://github.com/llvm/llvm-project/commit/c1c9eb0ab7d20e61f0fb345a60694bda0487c0da.diff
LOG: [Transforms] Check validity of profile reader before invoking it
Although an invalid sampling profile would fail the compilation anyway,
this avoids crashing the compiler.
Added:
Modified:
llvm/lib/Transforms/IPO/SampleProfile.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index eb0747fde6d3..697341443273 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1843,9 +1843,9 @@ ModulePass *llvm::createSampleProfileLoaderPass(StringRef Name) {
bool SampleProfileLoader::runOnModule(Module &M, ModuleAnalysisManager *AM,
ProfileSummaryInfo *_PSI, CallGraph *CG) {
- GUIDToFuncNameMapper Mapper(M, *Reader, GUIDToFuncNameMap);
if (!ProfileIsValid)
return false;
+ GUIDToFuncNameMapper Mapper(M, *Reader, GUIDToFuncNameMap);
PSI = _PSI;
if (M.getProfileSummary(/* IsCS */ false) == nullptr)
More information about the llvm-commits
mailing list