mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-04 09:54:09 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302705 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
66571bbb0a
commit
63eb7ab316
@ -330,6 +330,7 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
|
||||
const Module &M,
|
||||
std::function<BlockFrequencyInfo *(const Function &F)> GetBFICallback,
|
||||
ProfileSummaryInfo *PSI) {
|
||||
assert(PSI);
|
||||
ModuleSummaryIndex Index;
|
||||
|
||||
// Identify the local values in the llvm.used and llvm.compiler.used sets,
|
||||
|
@ -446,7 +446,7 @@ ProcessThinLTOModule(Module &TheModule, ModuleSummaryIndex &Index,
|
||||
{
|
||||
raw_svector_ostream OS(OutputBuffer);
|
||||
ProfileSummaryInfo PSI(TheModule);
|
||||
auto Index = buildModuleSummaryIndex(TheModule, nullptr, nullptr);
|
||||
auto Index = buildModuleSummaryIndex(TheModule, nullptr, &PSI);
|
||||
WriteBitcodeToFile(&TheModule, OS, true, &Index);
|
||||
}
|
||||
return make_unique<ObjectMemoryBuffer>(std::move(OutputBuffer));
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user