https://github.com/teresajohnson edited
https://github.com/llvm/llvm-project/pull/147265
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,43 @@
+// REQUIRES: lld
+
+/// Check DTLTO options are forwarded to the linker.
+
+// RUN: echo "--target=x86_64-linux-gnu \
+// RUN: -Xthinlto-distributor=distarg1 \
+// RUN: -Xthinlto-distributor=distarg2,distarg3 \
+// RUN: -fuse-ld=lld" > %t.rsp
+
+/// Check t
@@ -455,6 +455,21 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C,
const JobAction &JA,
addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs,
D.getLTOMode() == LTOK_Thin);
+ // Forward the DTLTO options to the linker. We add these uncondi
@@ -0,0 +1,43 @@
+// REQUIRES: lld
+
+/// Check DTLTO options are forwarded to the linker.
+
+// RUN: echo "--target=x86_64-linux-gnu \
+// RUN: -Xthinlto-distributor=distarg1 \
+// RUN: -Xthinlto-distributor=distarg2,distarg3 \
+// RUN: -fuse-ld=lld" > %t.rsp
+
+/// Check t
https://github.com/teresajohnson commented:
A few minor comments/questions
https://github.com/llvm/llvm-project/pull/147265
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1158,7 +1158,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
return;
}
MPM.addPass(ThinLTOBitcodeWriterPass(
-*OS, ThinLinkOS ? &ThinLinkOS->os() : nullptr));
+*OS, ThinLinkOS ? &ThinLinkOS->os() : nullptr, false, T
@@ -21,46 +24,64 @@ using namespace llvm;
PreservedAnalyses BitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM)
{
M.removeDebugIntrinsicDeclarations();
- const ModuleSummaryIndex *Index =
- EmitSummaryIndex ? &(AM.getResult(M))
- : nullp
@@ -568,31 +572,44 @@ bool writeThinLTOBitcode(raw_ostream &OS, raw_ostream
*ThinLinkOS,
// produced for the full link.
ModuleHash ModHash = {{0}};
WriteBitcodeToFile(M, OS, ShouldPreserveUseListOrder, Index,
- /*GenerateHash=*/true, &ModHash);
+
@@ -89,6 +93,8 @@ initializeRecordStreamer(const Module &M,
std::unique_ptr MAI(T->createMCAsmInfo(*MRI, TT.str(),
MCOptions));
teresajohnson wrote:
Should the MCOptions from TM be passed down to createMCAsmInfo?
https://github.com/llvm/llvm-project/pull/143
@@ -139,39 +146,43 @@ initializeRecordStreamer(const Module &M,
void ModuleSymbolTable::CollectAsmSymbols(
const Module &M,
-function_ref AsmSymbol) {
- initializeRecordStreamer(M, [&](RecordStreamer &Streamer) {
-Streamer.flushSymverDirectives();
-
-for (auto
teresajohnson wrote:
> Hi @teresajohnson what do you think? For the case of PGO, I think we may
> disable it. I think The speculative devirtualization is useful for cases
> where we don't have enough information.
Yes I think the spec results are promising. I'd suggest also trying with a
large
https://github.com/teresajohnson approved this pull request.
https://github.com/llvm/llvm-project/pull/142901
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -4204,13 +4204,15 @@ def ftrigraphs : Flag<["-"], "ftrigraphs">,
Group,
def fno_trigraphs : Flag<["-"], "fno-trigraphs">, Group,
HelpText<"Do not process trigraph sequences">,
Visibility<[ClangOption, CC1Option]>;
-defm unique_source_file_names: BoolOption<"f", "unique-
@@ -0,0 +1,658 @@
+//===- MemProfInstrumentation.cpp - memory allocation and access profiler
+// instrumentation ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+
https://github.com/teresajohnson approved this pull request.
Couple comments below but otherwise lgtm
https://github.com/llvm/llvm-project/pull/142811
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listin
@@ -58,97 +43,11 @@ namespace llvm {
extern cl::opt PGOWarnMissing;
extern cl::opt NoPGOWarnMismatch;
extern cl::opt NoPGOWarnMismatchComdatWeak;
+extern cl::opt MemProfReportHintedSizes;
teresajohnson wrote:
I think these 3 can be removed - I assume these cam
https://github.com/teresajohnson edited
https://github.com/llvm/llvm-project/pull/142811
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
teresajohnson wrote:
This is an interesting idea, thanks for the performance numbers. It could also
be useful for LTO without whole program visibility enabled, where most of the
vtables and type tests will end up with public visibility making them
ineligible for WPD. But I suspect it may not b
https://github.com/teresajohnson approved this pull request.
https://github.com/llvm/llvm-project/pull/135728
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
teresajohnson wrote:
> > I was mostly thinking that detecting and erroring at LTO time would result
> > in a clearer error (like at the start of LTO::addModule, where it is
> > looking for partially split LTO units, which we do by adding the module
> > flag to the index flags).
>
> I don't th
teresajohnson wrote:
> > I assume this will give a duplicate symbol linker error if used
> > inappropriately? Any chance of more subtle bugs?
>
> As far as LTO is concerned I think it can only result in a duplicate symbol
> error as the resulting symbols will have external strong linkage. Ther
@@ -6,7 +6,7 @@
; RUN: opt -thinlto-bc -o %t.o %s
; RUN: %clang_cc1 -triple x86_64-grtev4-linux-gnu \
-; RUN: -fthinlto-index=%S/Inputs/thinlto-distributed-backend-skip.bc \
+; RUN: -fthinlto-index=%S/../Inputs/thinlto-distributed-backend-skip.bc \
teresaj
https://github.com/teresajohnson edited
https://github.com/llvm/llvm-project/pull/129736
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/teresajohnson approved this pull request.
lgtm with the change suggested by @ellishg to use getProfileGenName. I believe
we always specify a profile filename using the `=` form of the option, which is
why we have not encountered this issue.
https://github.com/llvm/llvm-proje
https://github.com/teresajohnson approved this pull request.
lgtm
https://github.com/llvm/llvm-project/pull/128920
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1617,6 +1617,10 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList
&Args,
}
}
+ if (Sanitize.needsMemProfRt())
+if (hasExportSymbolDirective(Args))
+ addExportedSymbol(CmdArgs, "___memprof_default_options_str");
teresajohnson wrote:
@@ -1617,6 +1617,10 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList
&Args,
}
}
+ if (Sanitize.needsMemProfRt())
+if (hasExportSymbolDirective(Args))
+ addExportedSymbol(CmdArgs, "___memprof_default_options_str");
teresajohnson wrote:
@@ -734,6 +755,10 @@ void darwin::Linker::ConstructJob(Compilation &C, const
JobAction &JA,
getMachOToolChain().addProfileRTLibs(Args, CmdArgs);
+ if (Args.hasArg(options::OPT_fmemory_profile_runtime_default_options_EQ))
+if (hasExportSymbolDirective(Args))
+ add
@@ -1,11 +1,12 @@
-; RUN: opt < %s -mtriple=x86_64-unknown-linux
-passes='function(memprof),memprof-module' -S | FileCheck %s
--check-prefixes=CHECK,EMPTY
-; RUN: opt < %s -mtriple=x86_64-unknown-linux
-passes='function(memprof),memprof-module' -S
-memprof-runtime-default-opti
@@ -17,3 +17,10 @@
// RUN: not %clangxx --target=x86_64-linux-gnu -fprofile-generate
-fmemory-profile-use=foo %s -### 2>&1 | FileCheck %s
--check-prefix=CONFLICTWITHPGOINSTR
// CONFLICTWITHPGOINSTR: error: invalid argument '-fmemory-profile-use=foo'
not allowed with '-fprof
https://github.com/teresajohnson commented:
Not opposed to adding this as a clang driver flag especially if it is needed
for something other than testing/debugging, however, you could presumably
always add the exported symbol when -fmemory-profiler is specified (or does the
linker give an erro
https://github.com/teresajohnson edited
https://github.com/llvm/llvm-project/pull/128615
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
teresajohnson wrote:
> > Thanks for the heads up, so I should not do a detailed code review for
> > PR127749? Is there more info on what you mean by a "no-backend DTLTO"?
>
> Yes, I think for now it will be better to understand the design of the
> current code review that Ben submitted but not
teresajohnson wrote:
> > I'm fine with DTLTO as a shorthand for "integrated distributed ThinLTO".
> > Great! I'm glad that you support this acronim too. :)
>
> > BTW thanks for sending the LLVM patch, I will review that tonight or more
> > likely tomorrow.
>
> Teresa, when reviewing, could you
@@ -911,6 +916,63 @@ static void setLiveRoot(ModuleSummaryIndex &Index,
StringRef Name) {
Summary->setLive(true);
}
+// Return true if the User U is reachable from a non-vtable user
+// through the use-def chain.
+static bool hasNonVTableUsers(const User *U, CXXABI *ABI
@@ -1920,6 +1924,18 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache
Cache,
ThinLTO.CombinedIndex, WholeProgramVisibilityEnabledInLTO,
DynamicExportSymbols, VisibleToRegularObjSymbols);
+ Triple TT(getTargetTriple());
+ DeadRTTIElimIndex(ThinLTO.Combine
@@ -0,0 +1,25 @@
+#include "llvm/Support/LibCXXABI.h"
+
+namespace llvm {
+
+std::unique_ptr CXXABI::Create(Triple &TT) {
+ if (TT.getOS() == Triple::Linux)
+return std::make_unique();
teresajohnson wrote:
This is overly restrictive, however, since Linux is
@@ -573,14 +574,29 @@ static void dropDeadSymbols(Module &Mod, const
GVSummaryMapTy &DefinedGlobals,
convertToDeclaration(GV);
}
+ Triple TT(Mod.getTargetTriple());
+ std::unique_ptr ABI = CXXABI::Create(TT);
+
// Now that all dead bodies have been dropped,
@@ -911,6 +916,61 @@ static void setLiveRoot(ModuleSummaryIndex &Index,
StringRef Name) {
Summary->setLive(true);
}
+static bool hasNonVTableUsers(const User *U, CXXABI *ABI) {
+ LLVM_DEBUG(dbgs() << "Check if " << *U << "has vtable users\n");
+ if (isa(U)) {
+//
@@ -911,6 +916,63 @@ static void setLiveRoot(ModuleSummaryIndex &Index,
StringRef Name) {
Summary->setLive(true);
}
+// Return true if the User U is reachable from a non-vtable user
+// through the use-def chain.
+static bool hasNonVTableUsers(const User *U, CXXABI *ABI
@@ -1187,8 +1191,10 @@ Error LTO::run(AddStreamFn AddStream, FileCache Cache) {
return PrevailingType::Unknown;
return It->second;
};
- computeDeadSymbolsWithConstProp(ThinLTO.CombinedIndex, GUIDPreservedSymbols,
- isPrevailing, Con
@@ -1592,6 +1592,7 @@ llvm::Value *ItaniumCXXABI::EmitTypeid(CodeGenFunction
&CGF,
cast(SrcRecordTy->castAs()->getDecl());
llvm::Value *Value = CGF.GetVTablePtr(ThisPtr, CGM.GlobalsInt8PtrTy,
ClassDecl);
+ CGF.EmitTypeMetadataCo
@@ -1920,6 +1924,18 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache
Cache,
ThinLTO.CombinedIndex, WholeProgramVisibilityEnabledInLTO,
DynamicExportSymbols, VisibleToRegularObjSymbols);
+ Triple TT(getTargetTriple());
+ DeadRTTIElimIndex(ThinLTO.Combine
@@ -50,6 +51,42 @@ findCallsAtConstantOffset(SmallVectorImpl
&DevirtCalls,
}
}
+static bool hasTypeIdLoadAtConstantOffset(const Module *M, Value *VPtr,
+ int64_t Offset, const CallInst *CI,
+
@@ -0,0 +1,49 @@
+#include "llvm/Transforms/IPO/DeadRTTIElimination.h"
+#include "llvm/ADT/Statistic.h"
+#include "llvm/IR/ModuleSummaryIndex.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/LibCXXABI.h"
+
+using namespace llvm;
+
+#define DEBUG_TYPE "dre"
+
+STATISTIC(
https://github.com/teresajohnson commented:
Thanks for sending the PR! I think this should enable some nice size savings
hopefully.
I went through most of it (though not the bitcode or llvm assembler changes
yet). A couple of concerns:
- It doesn't look like it is guarded on whole program visi
@@ -50,6 +51,42 @@ findCallsAtConstantOffset(SmallVectorImpl
&DevirtCalls,
}
}
+static bool hasTypeIdLoadAtConstantOffset(const Module *M, Value *VPtr,
+ int64_t Offset, const CallInst *CI,
+
@@ -1920,6 +1924,18 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache
Cache,
ThinLTO.CombinedIndex, WholeProgramVisibilityEnabledInLTO,
DynamicExportSymbols, VisibleToRegularObjSymbols);
+ Triple TT(getTargetTriple());
+ DeadRTTIElimIndex(ThinLTO.Combine
https://github.com/teresajohnson edited
https://github.com/llvm/llvm-project/pull/126336
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
teresajohnson wrote:
> > Thanks for sending this for review! I've only just skimmed the PR so far,
> > and need to dig more into it. However, it is massive. It's nice to see how
> > it all fits together, but for the purpose of reviewing and upstreaming,
> > could you split it up into multiple
https://github.com/teresajohnson approved this pull request.
lgtm
https://github.com/llvm/llvm-project/pull/90933
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1513,6 +1522,171 @@ class InProcessThinBackend : public ThinBackendProc {
return Error::success();
}
};
+
+/// This backend is utilized in the first round of a two-codegen round process.
+/// It first saves optimized bitcode files to disk before the codegen process
+/
@@ -1513,6 +1522,171 @@ class InProcessThinBackend : public ThinBackendProc {
return Error::success();
}
};
+
+/// This backend is utilized in the first round of a two-codegen round process.
+/// It first saves optimized bitcode files to disk before the codegen process
+/
@@ -0,0 +1,94 @@
+; This test verifies whether we can outline a singleton instance (i.e., an
instance that does not repeat)
teresajohnson wrote:
This test seems like mostly an overlap of the caching test, with the exception
of the regular LTO module interaction
@@ -1513,6 +1522,171 @@ class InProcessThinBackend : public ThinBackendProc {
return Error::success();
}
};
+
+/// This backend is utilized in the first round of a two-codegen round process.
+/// It first saves optimized bitcode files to disk before the codegen process
+/
@@ -74,6 +75,8 @@ static cl::opt ThinLTOAssumeMerged(
cl::desc("Assume the input has already undergone ThinLTO function "
"importing and the other pre-optimization pipeline changes."));
+extern cl::opt CodeGenDataThinLTOTwoRounds;
teresajohnso
https://github.com/teresajohnson approved this pull request.
https://github.com/llvm/llvm-project/pull/90934
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -586,7 +586,9 @@ Error lto::thinBackend(const Config &Conf, unsigned Task,
AddStreamFn AddStream,
Mod.setPartialSampleProfileRatio(CombinedIndex);
LLVM_DEBUG(dbgs() << "Running ThinLTO\n");
- if (Conf.CodeGenOnly) {
+ if (CodeGenOnly) {
teresajohnson
teresajohnson wrote:
> > * Looking at the NFC, this seems like it has very similar issues to
> > Propeller, which wants to redo just the codegen with a new injected profile
> > and BB ordering. It would be good to see if we can converge to similar
> > approaches. I asked @rlavaee to take a loo
teresajohnson wrote:
> > @teresajohnson Do you have any concern or comment on this direction?
>
> Just a quick reply to say that I am taking a look today (unfamiliar with this
> approach so need to read through the RFC etc) and will get back later today
Sorry I was obviously over optimistic on
teresajohnson wrote:
> @teresajohnson Do you have any concern or comment on this direction?
Just a quick reply to say that I am taking a look today (unfamiliar with this
approach so need to read through the RFC etc) and will get back later today
https://github.com/llvm/llvm-project/pull/90933
https://github.com/teresajohnson approved this pull request.
lgtm
https://github.com/llvm/llvm-project/pull/94264
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -322,14 +796,133 @@ bool
IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
if (!NumCandidates ||
(PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount)))
continue;
+
auto PromotionCandidates = getPromotionCandidatesForCallSite
@@ -103,27 +112,226 @@ static cl::opt
ICPDUMPAFTER("icp-dumpafter", cl::init(false), cl::Hidden,
cl::desc("Dump IR after transformation happens"));
+// Indirect call promotion pass will fall back to function-based comparison if
+// vtable-count / function-
https://github.com/teresajohnson edited
https://github.com/llvm/llvm-project/pull/81442
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -322,14 +796,133 @@ bool
IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
if (!NumCandidates ||
(PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount)))
continue;
+
auto PromotionCandidates = getPromotionCandidatesForCallSite
@@ -140,14 +348,56 @@ class IndirectCallPromoter {
// indirect callee with functions. Returns true if there are IR
// transformations and false otherwise.
bool tryToPromoteWithFuncCmp(
- CallBase &CB, const std::vector &Candidates,
- uint64_t TotalCount, ArrayRe
@@ -322,14 +796,133 @@ bool
IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
if (!NumCandidates ||
(PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount)))
continue;
+
auto PromotionCandidates = getPromotionCandidatesForCallSite
@@ -1425,16 +1430,27 @@ MDNode *getPGOFuncNameMetadata(const Function &F) {
return F.getMetadata(getPGOFuncNameMetadataName());
}
-void createPGOFuncNameMetadata(Function &F, StringRef PGOFuncName) {
- // Only for internal linkage functions.
- if (PGOFuncName == F.getName(
@@ -103,27 +112,226 @@ static cl::opt
ICPDUMPAFTER("icp-dumpafter", cl::init(false), cl::Hidden,
cl::desc("Dump IR after transformation happens"));
+// Indirect call promotion pass will fall back to function-based comparison if
+// vtable-count / function-
@@ -277,35 +626,160 @@ CallBase &llvm::pgo::promoteIndirectCall(CallBase &CB,
Function *DirectCallee,
// Promote indirect-call to conditional direct-call for one callsite.
bool IndirectCallPromoter::tryToPromoteWithFuncCmp(
-CallBase &CB, const std::vector &Candidates,
-
https://github.com/teresajohnson approved this pull request.
lgtm with some mostly comment related fixes/suggestions
https://github.com/llvm/llvm-project/pull/81442
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/
@@ -103,27 +112,226 @@ static cl::opt
ICPDUMPAFTER("icp-dumpafter", cl::init(false), cl::Hidden,
cl::desc("Dump IR after transformation happens"));
+// Indirect call promotion pass will fall back to function-based comparison if
+// vtable-count / function-
@@ -277,35 +626,160 @@ CallBase &llvm::pgo::promoteIndirectCall(CallBase &CB,
Function *DirectCallee,
// Promote indirect-call to conditional direct-call for one callsite.
bool IndirectCallPromoter::tryToPromoteWithFuncCmp(
-CallBase &CB, const std::vector &Candidates,
-
@@ -322,14 +796,133 @@ bool
IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
if (!NumCandidates ||
(PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount)))
continue;
+
auto PromotionCandidates = getPromotionCandidatesForCallSite
@@ -1425,16 +1430,27 @@ MDNode *getPGOFuncNameMetadata(const Function &F) {
return F.getMetadata(getPGOFuncNameMetadataName());
}
-void createPGOFuncNameMetadata(Function &F, StringRef PGOFuncName) {
- // Only for internal linkage functions.
- if (PGOFuncName == F.getName(
@@ -103,27 +112,226 @@ static cl::opt
ICPDUMPAFTER("icp-dumpafter", cl::init(false), cl::Hidden,
cl::desc("Dump IR after transformation happens"));
+// Indirect call promotion pass will fall back to function-based comparison if
+// vtable-count / function-
@@ -20,25 +20,25 @@ CHECK-NEXT: -
CHECK: Records:
CHECK-NEXT: -
-CHECK-NEXT:FunctionGUID: 15505678318020221912
+CHECK-NEXT:FunctionGUID: 3873612792189045660
CHECK-NEXT:AllocSites:
CHECK-NEXT:-
CHECK-NEXT: Callstack:
CHECK-NEXT: -
-CHECK-NEXT:
@@ -96,19 +102,63 @@ llvm::SmallVector readSegmentEntries(const
char *Ptr) {
}
llvm::SmallVector>
-readMemInfoBlocks(const char *Ptr) {
+readMemInfoBlocksV3(const char *Ptr) {
using namespace support;
const uint64_t NumItemsToRead =
- endian::readNext(Ptr);
+
@@ -216,6 +228,35 @@ u64 GetShadowCount(uptr p, u32 size) {
return count;
}
+// Accumulates the access count from the shadow for the given pointer and size.
+// See memprof_mapping.h for an overview on histogram counters.
+u64 GetShadowCountHistogram(uptr p, u32 size) {
+ u
@@ -0,0 +1,101 @@
+REQUIRES: x86_64-linux
+
+This is a copy of memprof-basict.test with slight changes to check that we can
still read v3 of memprofraw.
+
+To update the inputs used below run Inputs/update_memprof_inputs.sh
/path/to/updated/clang
teresajohnson w
@@ -38,4 +38,5 @@ MEMPROF_FLAG(bool,
allocator_frees_and_returns_null_on_realloc_zero, true,
MEMPROF_FLAG(bool, print_text, false,
"If set, prints the heap profile in text format. Else use the raw binary
serialization format.")
MEMPROF_FLAG(bool, print_terse, false,
-
@@ -205,8 +205,14 @@ class RawMemProfReader final : public MemProfReader {
object::SectionedAddress getModuleOffset(uint64_t VirtualAddress);
+ llvm::SmallVector>
+ readMemInfoBlocks(const char *Ptr);
+
// The profiled binary.
object::OwningBinary Binary;
+ // Vers
@@ -610,13 +670,33 @@ RawMemProfReader::peekBuildIds(MemoryBuffer *DataBuffer) {
return BuildIds.takeVector();
}
+// FIXME: Add a schema for serializing similiar to IndexedMemprofReader. This
+// will help being able to deserialize different versions raw memprof versions
+//
@@ -610,13 +670,33 @@ RawMemProfReader::peekBuildIds(MemoryBuffer *DataBuffer) {
return BuildIds.takeVector();
}
+// FIXME: Add a schema for serializing similiar to IndexedMemprofReader. This
+// will help being able to deserialize different versions raw memprof versions
+//
@@ -0,0 +1,101 @@
+REQUIRES: x86_64-linux
+
+This is a copy of memprof-basict.test with slight changes to check that we can
still read v3 of memprofraw.
teresajohnson wrote:
typo: basict
https://github.com/llvm/llvm-project/pull/94264
__
@@ -216,6 +228,35 @@ u64 GetShadowCount(uptr p, u32 size) {
return count;
}
+// Accumulates the access count from the shadow for the given pointer and size.
+// See memprof_mapping.h for an overview on histogram counters.
+u64 GetShadowCountHistogram(uptr p, u32 size) {
+ u
@@ -124,6 +124,13 @@ struct PortableMemInfoBlock {
OS << "" << #Name << ": " << Name << "\n";
#include "llvm/ProfileData/MIBEntryDef.inc"
#undef MIBEntryDef
+if (AccessHistogramSize > 0) {
+ OS << "" << "AccessHistogramValues" << ":";
+ for (uint
@@ -508,7 +519,26 @@ void createProfileFileNameVar(Module &M) {
}
}
+// Set MemprofHistogramFlag as a Global veriable in IR. This makes it
accessible
+// to
teresajohnson wrote:
nit: fix line wrapping
https://github.com/llvm/llvm-project/pull/94264
__
@@ -96,19 +102,63 @@ llvm::SmallVector readSegmentEntries(const
char *Ptr) {
}
llvm::SmallVector>
-readMemInfoBlocks(const char *Ptr) {
+readMemInfoBlocksV3(const char *Ptr) {
using namespace support;
const uint64_t NumItemsToRead =
- endian::readNext(Ptr);
+
@@ -20,25 +20,25 @@ CHECK-NEXT: -
CHECK: Records:
CHECK-NEXT: -
-CHECK-NEXT:FunctionGUID: 15505678318020221912
+CHECK-NEXT:FunctionGUID: 3873612792189045660
CHECK-NEXT:AllocSites:
CHECK-NEXT:-
CHECK-NEXT: Callstack:
CHECK-NEXT: -
-CHECK-NEXT:
@@ -508,7 +519,26 @@ void createProfileFileNameVar(Module &M) {
}
}
+// Set MemprofHistogramFlag as a Global veriable in IR. This makes it
accessible
+// to
+// the runtime, changing shadow count behavior.
+void createMemprofHistogramFlagVar(Module &M) {
+ const StringRef
@@ -216,6 +228,35 @@ u64 GetShadowCount(uptr p, u32 size) {
return count;
}
+// Accumulates the access count from the shadow for the given pointer and size.
+// See memprof_mapping.h for an overview on histogram counters.
+u64 GetShadowCountHistogram(uptr p, u32 size) {
+ u
@@ -140,14 +337,51 @@ class IndirectCallPromoter {
// indirect callee with functions. Returns true if there are IR
// transformations and false otherwise.
bool tryToPromoteWithFuncCmp(
- CallBase &CB, const std::vector &Candidates,
- uint64_t TotalCount, ArrayRe
@@ -321,14 +746,127 @@ bool
IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
if (!NumCandidates ||
(PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount)))
continue;
+
auto PromotionCandidates = getPromotionCandidatesForCallSite
@@ -103,30 +110,220 @@ static cl::opt
ICPDUMPAFTER("icp-dumpafter", cl::init(false), cl::Hidden,
cl::desc("Dump IR after transformation happens"));
+// This option is meant to be used by LLVM regression test and test the
+// transformation that compares vt
@@ -103,30 +110,220 @@ static cl::opt
ICPDUMPAFTER("icp-dumpafter", cl::init(false), cl::Hidden,
cl::desc("Dump IR after transformation happens"));
+// This option is meant to be used by LLVM regression test and test the
+// transformation that compares vt
@@ -140,14 +337,51 @@ class IndirectCallPromoter {
// indirect callee with functions. Returns true if there are IR
// transformations and false otherwise.
bool tryToPromoteWithFuncCmp(
- CallBase &CB, const std::vector &Candidates,
- uint64_t TotalCount, ArrayRe
@@ -341,6 +879,17 @@ static bool promoteIndirectCalls(Module &M,
ProfileSummaryInfo *PSI, bool InLTO,
return false;
}
bool Changed = false;
+ VirtualCallSiteTypeInfoMap VirtualCSInfo;
+
+ computeVirtualCallSiteTypeInfoMap(M, MAM, VirtualCSInfo);
+
+ // This map reco
@@ -103,30 +110,222 @@ static cl::opt
ICPDUMPAFTER("icp-dumpafter", cl::init(false), cl::Hidden,
cl::desc("Dump IR after transformation happens"));
+// This option is meant to be used by LLVM regression test and test the
+// transformation that compares vt
1 - 100 of 367 matches
Mail list logo