Skip to content

Commit 565ba9a

Browse files
committed
fixup: error handling for SampleProfileReader::read() call
1 parent d080c74 commit 565ba9a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llvm/lib/Transforms/IPO/UnpredictableProfileLoader.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ bool UnpredictableProfileLoaderPass::loadSampleProfile(Module &M) {
182182
}
183183

184184
ReaderPtr = std::move(ReaderOrErr.get());
185-
ReaderPtr->read();
185+
if (std::error_code EC = ReaderPtr->read()) {
186+
std::string Msg = "Profile reading failed: " + EC.message();
187+
Ctx.diagnose(DiagnosticInfoSampleProfile(ProfileFile, Msg));
188+
return false;
189+
}
186190

187191
return true;
188192
};

0 commit comments

Comments
 (0)