summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-06-20 01:38:56 +0000
committerVedant Kumar <vsk@apple.com>2017-06-20 01:38:56 +0000
commitb5794ca90c4e1e236eb98bf84b3e3be5e31edc32 (patch)
tree7d7fb893a3a2378d6547b904546f449d7f346fe5 /llvm/lib/Transforms
parent4f05b362855cd10b35608a36b18a04647920309c (diff)
downloadbcm5719-llvm-b5794ca90c4e1e236eb98bf84b3e3be5e31edc32.tar.gz
bcm5719-llvm-b5794ca90c4e1e236eb98bf84b3e3be5e31edc32.zip
[ProfileData] PR33517: Check for failure of symtab creation
With PR33517, it became apparent that symbol table creation can fail when presented with malformed inputs. This patch makes that sort of error detectable, so llvm-cov etc. can fail more gracefully. Specifically, we now check that function names within the symbol table aren't empty. Testing: check-{llvm,clang,profile}, some unit test updates. llvm-svn: 305765
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
index 0d308810009..4089d81ea3e 100644
--- a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
+++ b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
@@ -642,7 +642,12 @@ static bool promoteIndirectCalls(Module &M, bool InLTO, bool SamplePGO) {
if (DisableICP)
return false;
InstrProfSymtab Symtab;
- Symtab.create(M, InLTO);
+ if (Error E = Symtab.create(M, InLTO)) {
+ std::string SymtabFailure = toString(std::move(E));
+ DEBUG(dbgs() << "Failed to create symtab: " << SymtabFailure << "\n");
+ (void)SymtabFailure;
+ return false;
+ }
bool Changed = false;
for (auto &F : M) {
if (F.isDeclaration())
OpenPOWER on IntegriCloud