diff --git a/llvm/lib/Bitstream/Reader/BitstreamReader.cpp b/llvm/lib/Bitstream/Reader/BitstreamReader.cpp --- a/llvm/lib/Bitstream/Reader/BitstreamReader.cpp +++ b/llvm/lib/Bitstream/Reader/BitstreamReader.cpp @@ -98,7 +98,7 @@ Expected MaybeVBR = ReadVBR(6); if (!MaybeVBR) return MaybeVBR.get(); - unsigned NumElts = MaybeVBR.get(); + unsigned NumElts = MaybeVBR.takeError(); for (unsigned i = 0; i != NumElts; ++i) if (Expected Res = ReadVBR64(6)) ; // Skip! diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -183,6 +183,11 @@ cl::desc("Inline cold call sites in profile loader if it's beneficial " "for code size.")); +static cl::opt ProfileInlineFunctions( + "sample-profile-inline-functions", cl::Hidden, cl::init(true), + cl::desc("If false, inliner is turned off in profile loader. Used for " + "debugging or evaluation.")); + cl::opt ProfileInlineGrowthLimit( "sample-profile-inline-growth-limit", cl::Hidden, cl::init(12), cl::desc("The size growth ratio limit for proirity-based sample profile " @@ -1111,6 +1116,8 @@ /// \returns True if there is any inline happened. bool SampleProfileLoader::inlineHotFunctions( Function &F, DenseSet &InlinedGUIDs) { + if (!ProfileInlineFunctions) + return; // ProfAccForSymsInList is used in callsiteIsHot. The assertion makes sure // Profile symbol list is ignored when profile-sample-accurate is on. assert((!ProfAccForSymsInList ||