[clang] [llvm] [DTLTO][Clang] Add support for Integrated Distributed ThinLTO (PR #147265)

2025-07-09 Thread Teresa Johnson via cfe-commits
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

[clang] [llvm] [DTLTO][Clang] Add support for Integrated Distributed ThinLTO (PR #147265)

2025-07-09 Thread Teresa Johnson via 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

[clang] [llvm] [DTLTO][Clang] Add support for Integrated Distributed ThinLTO (PR #147265)

2025-07-09 Thread Teresa Johnson via 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

[clang] [llvm] [DTLTO][Clang] Add support for Integrated Distributed ThinLTO (PR #147265)

2025-07-09 Thread Teresa Johnson via 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

[clang] [llvm] [DTLTO][Clang] Add support for Integrated Distributed ThinLTO (PR #147265)

2025-07-09 Thread Teresa Johnson via 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

[clang] [llvm] Pass TargetMachine from from Clang to `BitcodeWriter`and `ThinLTOBitcodeWriter` pass for thin and fat LTO respectively. (PR #143692)

2025-06-16 Thread Teresa Johnson via 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

[clang] [llvm] Pass TargetMachine from from Clang to `BitcodeWriter`and `ThinLTOBitcodeWriter` pass for thin and fat LTO respectively. (PR #143692)

2025-06-16 Thread Teresa Johnson via cfe-commits
@@ -21,46 +24,64 @@ using namespace llvm; PreservedAnalyses BitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM) { M.removeDebugIntrinsicDeclarations(); - const ModuleSummaryIndex *Index = - EmitSummaryIndex ? &(AM.getResult(M)) - : nullp

[clang] [llvm] Pass TargetMachine from from Clang to `BitcodeWriter`and `ThinLTOBitcodeWriter` pass for thin and fat LTO respectively. (PR #143692)

2025-06-16 Thread Teresa Johnson via cfe-commits
@@ -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); +

[clang] [llvm] Pass TargetMachine from from Clang to `BitcodeWriter`and `ThinLTOBitcodeWriter` pass for thin and fat LTO respectively. (PR #143692)

2025-06-16 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [llvm] Pass TargetMachine from from Clang to `BitcodeWriter`and `ThinLTOBitcodeWriter` pass for thin and fat LTO respectively. (PR #143692)

2025-06-16 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [llvm] Enable WPD without lto (PR #141777)

2025-06-09 Thread Teresa Johnson via cfe-commits
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

[clang] [llvm] Add -funique-source-file-identifier flag. (PR #142901)

2025-06-05 Thread Teresa Johnson via cfe-commits
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

[clang] [llvm] Add -funique-source-file-identifier flag. (PR #142901)

2025-06-05 Thread Teresa Johnson via 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-

[clang] [llvm] [MemProf] Split MemProfiler into Instrumentation and Use. (PR #142811)

2025-06-04 Thread Teresa Johnson via cfe-commits
@@ -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. +

[clang] [llvm] [MemProf] Split MemProfiler into Instrumentation and Use. (PR #142811)

2025-06-04 Thread Teresa Johnson via 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

[clang] [llvm] [MemProf] Split MemProfiler into Instrumentation and Use. (PR #142811)

2025-06-04 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [llvm] [MemProf] Split MemProfiler into Instrumentation and Use. (PR #142811)

2025-06-04 Thread Teresa Johnson via cfe-commits
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

[clang] [llvm] Enable WPD without lto (PR #141777)

2025-05-29 Thread Teresa Johnson via 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

[clang] [llvm] Introduce -funique-source-file-names flag. (PR #135728)

2025-04-15 Thread Teresa Johnson via cfe-commits
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

[clang] [llvm] Introduce -funique-source-file-names flag. (PR #135728)

2025-04-15 Thread Teresa Johnson via 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

[clang] [llvm] Introduce -funique-source-file-names flag. (PR #135728)

2025-04-15 Thread Teresa Johnson via cfe-commits
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

[clang] Avoid Assertion Failure Using -fcs-profile-generate with distributed thin-lto (PR #129736)

2025-03-15 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] Avoid Assertion Failure Using -fcs-profile-generate with distributed thin-lto (PR #129736)

2025-03-06 Thread Teresa Johnson via cfe-commits
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

[clang] Avoid Assertion Failure Using -fcs-profile-generate with distributed thin-lto (PR #129736)

2025-03-06 Thread Teresa Johnson via 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

[clang] [llvm] [memprof] Export __memprof_default_options_str on Darwin (PR #128920)

2025-03-02 Thread Teresa Johnson via cfe-commits
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

[clang] [memprof] Export __memprof_default_options_str on Darwin (PR #128920)

2025-02-28 Thread Teresa Johnson via 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:

[clang] [memprof] Export __memprof_default_options_str on Darwin (PR #128920)

2025-02-26 Thread Teresa Johnson via 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:

[clang] [llvm] [memprof] Add memprof options as a clang frontend flag (PR #128615)

2025-02-26 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [llvm] [memprof] Add memprof options as a clang frontend flag (PR #128615)

2025-02-26 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [llvm] [memprof] Add memprof options as a clang frontend flag (PR #128615)

2025-02-26 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [llvm] [memprof] Add memprof options as a clang frontend flag (PR #128615)

2025-02-26 Thread Teresa Johnson via cfe-commits
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

[clang] [llvm] [memprof] Add memprof options as a clang frontend flag (PR #128615)

2025-02-26 Thread Teresa Johnson via cfe-commits
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

[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)

2025-02-24 Thread Teresa Johnson via 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

[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)

2025-02-20 Thread Teresa Johnson via cfe-commits
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

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-18 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-18 Thread Teresa Johnson via cfe-commits
@@ -1920,6 +1924,18 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache Cache, ThinLTO.CombinedIndex, WholeProgramVisibilityEnabledInLTO, DynamicExportSymbols, VisibleToRegularObjSymbols); + Triple TT(getTargetTriple()); + DeadRTTIElimIndex(ThinLTO.Combine

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-18 Thread Teresa Johnson via 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

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-12 Thread Teresa Johnson via cfe-commits
@@ -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,

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-12 Thread Teresa Johnson via cfe-commits
@@ -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)) { +//

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-12 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-12 Thread Teresa Johnson via cfe-commits
@@ -1187,8 +1191,10 @@ Error LTO::run(AddStreamFn AddStream, FileCache Cache) { return PrevailingType::Unknown; return It->second; }; - computeDeadSymbolsWithConstProp(ThinLTO.CombinedIndex, GUIDPreservedSymbols, - isPrevailing, Con

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-12 Thread Teresa Johnson via 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

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-12 Thread Teresa Johnson via cfe-commits
@@ -1920,6 +1924,18 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache Cache, ThinLTO.CombinedIndex, WholeProgramVisibilityEnabledInLTO, DynamicExportSymbols, VisibleToRegularObjSymbols); + Triple TT(getTargetTriple()); + DeadRTTIElimIndex(ThinLTO.Combine

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-12 Thread Teresa Johnson via cfe-commits
@@ -50,6 +51,42 @@ findCallsAtConstantOffset(SmallVectorImpl &DevirtCalls, } } +static bool hasTypeIdLoadAtConstantOffset(const Module *M, Value *VPtr, + int64_t Offset, const CallInst *CI, +

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-12 Thread Teresa Johnson via cfe-commits
@@ -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(

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-12 Thread Teresa Johnson via cfe-commits
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

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-12 Thread Teresa Johnson via cfe-commits
@@ -50,6 +51,42 @@ findCallsAtConstantOffset(SmallVectorImpl &DevirtCalls, } } +static bool hasTypeIdLoadAtConstantOffset(const Module *M, Value *VPtr, + int64_t Offset, const CallInst *CI, +

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-12 Thread Teresa Johnson via cfe-commits
@@ -1920,6 +1924,18 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache Cache, ThinLTO.CombinedIndex, WholeProgramVisibilityEnabledInLTO, DynamicExportSymbols, VisibleToRegularObjSymbols); + Triple TT(getTargetTriple()); + DeadRTTIElimIndex(ThinLTO.Combine

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-12 Thread Teresa Johnson via cfe-commits
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

[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)

2025-02-11 Thread Teresa Johnson via 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

[clang] [llvm] [CGData][ThinLTO] Global Outlining with Two-CodeGen Rounds (PR #90933)

2024-10-09 Thread Teresa Johnson via cfe-commits
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

[clang] [llvm] [CGData][ThinLTO] Global Outlining with Two-CodeGen Rounds (PR #90933)

2024-10-09 Thread Teresa Johnson via 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 +/

[clang] [llvm] [CGData][ThinLTO] Global Outlining with Two-CodeGen Rounds (PR #90933)

2024-10-08 Thread Teresa Johnson via 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 +/

[clang] [llvm] [CGData][ThinLTO] Global Outlining with Two-CodeGen Rounds (PR #90933)

2024-10-08 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [llvm] [CGData][ThinLTO] Global Outlining with Two-CodeGen Rounds (PR #90933)

2024-10-08 Thread Teresa Johnson via 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 +/

[clang] [llvm] [CGData][ThinLTO] Global Outlining with Two-CodeGen Rounds (PR #90933)

2024-10-08 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [llvm] [CGData][ThinLTO][NFC] Prep for two-codegen rounds (PR #90934)

2024-10-02 Thread Teresa Johnson via cfe-commits
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

[clang] [llvm] [CGData][ThinLTO][NFC] Prep for two-codegen rounds (PR #90934)

2024-10-02 Thread Teresa Johnson via 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

[clang] [llvm] [CGData][ThinLTO] Global Outlining with Two-CodeGen Rounds (PR #90933)

2024-09-30 Thread Teresa Johnson via cfe-commits
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

[clang] [llvm] [CGData][ThinLTO] Global Outlining with Two-CodeGen Rounds (PR #90933)

2024-09-27 Thread Teresa Johnson via cfe-commits
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

[clang] [llvm] [CGData][ThinLTO] Global Outlining with Two-CodeGen Rounds (PR #90933)

2024-09-25 Thread Teresa Johnson via cfe-commits
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

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-25 Thread Teresa Johnson via cfe-commits
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

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via cfe-commits
@@ -322,14 +796,133 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) { if (!NumCandidates || (PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount))) continue; + auto PromotionCandidates = getPromotionCandidatesForCallSite

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via 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-

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via cfe-commits
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

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via cfe-commits
@@ -322,14 +796,133 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) { if (!NumCandidates || (PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount))) continue; + auto PromotionCandidates = getPromotionCandidatesForCallSite

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via cfe-commits
@@ -322,14 +796,133 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) { if (!NumCandidates || (PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount))) continue; + auto PromotionCandidates = getPromotionCandidatesForCallSite

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via cfe-commits
@@ -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(

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via 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-

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via cfe-commits
@@ -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, -

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via cfe-commits
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/

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via 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-

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via cfe-commits
@@ -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, -

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via cfe-commits
@@ -322,14 +796,133 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) { if (!NumCandidates || (PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount))) continue; + auto PromotionCandidates = getPromotionCandidatesForCallSite

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via cfe-commits
@@ -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(

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-24 Thread Teresa Johnson via 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-

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-24 Thread Teresa Johnson via cfe-commits
@@ -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:

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-24 Thread Teresa Johnson via cfe-commits
@@ -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); +

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-24 Thread Teresa Johnson via cfe-commits
@@ -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

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -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

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -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, -

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -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

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -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 +//

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -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 +//

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -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 __

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -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

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -124,6 +124,13 @@ struct PortableMemInfoBlock { OS << "" << #Name << ": " << Name << "\n"; #include "llvm/ProfileData/MIBEntryDef.inc" #undef MIBEntryDef +if (AccessHistogramSize > 0) { + OS << "" << "AccessHistogramValues" << ":"; + for (uint

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -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 __

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -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); +

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -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:

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -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

[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

2024-06-21 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-04 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-04 Thread Teresa Johnson via cfe-commits
@@ -321,14 +746,127 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) { if (!NumCandidates || (PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount))) continue; + auto PromotionCandidates = getPromotionCandidatesForCallSite

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-04 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-04 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-04 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-04 Thread Teresa Johnson via cfe-commits
@@ -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

[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

2024-06-04 Thread Teresa Johnson via cfe-commits
@@ -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   2   3   4   >