@@ -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
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
@@ -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-
@@ -322,14 +796,133 @@ bool
IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
if (!NumCandidates ||
(PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount)))
continue;
+
auto PromotionCandidates = getPromotionCandidatesForCallSite
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
@@ -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.
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
+/
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:
> > * 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
https://github.com/llvm/llvm-project/pull/90933
@@ -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
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
@@ -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
@@ -1187,8 +1191,10 @@ Error LTO::run(AddStreamFn AddStream, FileCache Cache) {
return PrevailingType::Unknown;
return It->second;
};
- computeDeadSymbolsWithConstProp(ThinLTO.CombinedIndex, GUIDPreservedSymbols,
- isPrevailing, Con
@@ -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
@@ -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)) {
+//
@@ -50,6 +51,42 @@ findCallsAtConstantOffset(SmallVectorImpl
&DevirtCalls,
}
}
+static bool hasTypeIdLoadAtConstantOffset(const Module *M, Value *VPtr,
+ int64_t Offset, const CallInst *CI,
+
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
@@ -1920,6 +1924,18 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache
Cache,
ThinLTO.CombinedIndex, WholeProgramVisibilityEnabledInLTO,
DynamicExportSymbols, VisibleToRegularObjSymbols);
+ Triple TT(getTargetTriple());
+ DeadRTTIElimIndex(ThinLTO.Combine
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
@@ -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
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
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
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
@@ -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
@@ -1920,6 +1924,18 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache
Cache,
ThinLTO.CombinedIndex, WholeProgramVisibilityEnabledInLTO,
DynamicExportSymbols, VisibleToRegularObjSymbols);
+ Triple TT(getTargetTriple());
+ DeadRTTIElimIndex(ThinLTO.Combine
@@ -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
@@ -1617,6 +1617,10 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList
&Args,
}
}
+ if (Sanitize.needsMemProfRt())
+if (hasExportSymbolDirective(Args))
+ addExportedSymbol(CmdArgs, "___memprof_default_options_str");
teresajohnson wrote:
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
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 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
@@ -50,6 +51,42 @@ findCallsAtConstantOffset(SmallVectorImpl
&DevirtCalls,
}
}
+static bool hasTypeIdLoadAtConstantOffset(const Module *M, Value *VPtr,
+ int64_t Offset, const CallInst *CI,
+
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
@@ -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(
@@ -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,
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
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
@@ -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
@@ -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
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
@@ -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 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
@@ -1617,6 +1617,10 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList
&Args,
}
}
+ if (Sanitize.needsMemProfRt())
+if (hasExportSymbolDirective(Args))
+ addExportedSymbol(CmdArgs, "___memprof_default_options_str");
teresajohnson wrote:
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
@@ -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);
+
@@ -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
@@ -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
@@ -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-
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 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
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
@@ -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.
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
@@ -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 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
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
@@ -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
301 - 367 of 367 matches
Mail list logo