[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
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
@@ -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
@@ -322,14 +796,133 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) { if (!NumCandidates || (PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount))) continue; + auto PromotionCandidates = getPromotionCandidatesForCallSite

[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] [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] 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-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-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-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] [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][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] [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
@@ -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
@@ -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
@@ -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
@@ -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
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] [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] [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] 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] [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] [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
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] [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-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
@@ -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] [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] [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] 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] 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] [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
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
@@ -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
@@ -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] [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] [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] [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
@@ -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
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
@@ -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 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] [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:

<    1   2   3   4