summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2017-05-10 18:52:16 +0000
committerTeresa Johnson <tejohnson@google.com>2017-05-10 18:52:16 +0000
commit94624aca2ab44a385ba154c72ecb8df3bba6ea62 (patch)
treeec1c9813618448a2bf54be675daa8ad0f19907c8 /llvm/lib/Transforms
parentecb97da1081225c0014177db63ec1f698d597c68 (diff)
downloadbcm5719-llvm-94624aca2ab44a385ba154c72ecb8df3bba6ea62.tar.gz
bcm5719-llvm-94624aca2ab44a385ba154c72ecb8df3bba6ea62.zip
Ensure non-null ProfileSummaryInfo passed to ModuleSummaryIndex builder
This fixes a ubsan bot failure after r302597, which made getProfileCount non-static, but ended up invoking it on a null ProfileSummaryInfo object in some cases from buildModuleSummaryIndex. Most testing passed because the non-static getProfileCount currently doesn't access any member variables, but I found this when testing a follow on patch (D32877) that adds a member variable access. llvm-svn: 302705
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
index d3a3c24ce7b..68884ce25bf 100644
--- a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
+++ b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
@@ -16,6 +16,7 @@
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/ModuleSummaryAnalysis.h"
+#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/TypeMetadataUtils.h"
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/IR/Constants.h"
@@ -320,7 +321,8 @@ void splitAndWriteThinLTOBitcode(
// FIXME: Try to re-use BSI and PFI from the original module here.
- ModuleSummaryIndex Index = buildModuleSummaryIndex(M, nullptr, nullptr);
+ ProfileSummaryInfo PSI(M);
+ ModuleSummaryIndex Index = buildModuleSummaryIndex(M, nullptr, &PSI);
SmallVector<char, 0> Buffer;
OpenPOWER on IntegriCloud