[clang] [llvm] [LTO] Reduce memory usage for import lists (PR #106772)

2024-08-30 Thread Mingming Liu via cfe-commits
@@ -215,13 +215,49 @@ class FunctionImporter { SmallVector getSourceModules() const; std::optional -getImportType(const FunctionsToImportTy &GUIDToImportType, - GlobalValue::GUID GUID) const; +getImportType(StringRef FromModule, GlobalValue::GU

[clang] [compiler-rt] [llvm] [IRPGO] [Draft] Import vtable definitions in ThinTLO and use more efficient vtable comparison sequence with cost-benefit analysis (PR #69141)

2024-05-24 Thread Mingming Liu via cfe-commits
https://github.com/minglotus-6 closed https://github.com/llvm/llvm-project/pull/69141 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] [IRPGO] [Draft] Import vtable definitions in ThinTLO and use more efficient vtable comparison sequence with cost-benefit analysis (PR #69141)

2024-05-24 Thread Mingming Liu via cfe-commits
minglotus-6 wrote: Close this stale patch and won't merge conflicts in this one. Working on https://github.com/llvm/llvm-project/pull/81442 now. https://github.com/llvm/llvm-project/pull/69141 ___ cfe-commits mailing list cfe-commits@lists.llvm.org ht

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

2024-06-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu 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-26 Thread Mingming Liu via cfe-commits
https://github.com/minglotus-6 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-26 Thread Mingming Liu via cfe-commits
https://github.com/minglotus-6 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-26 Thread Mingming Liu via cfe-commits
https://github.com/minglotus-6 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] [llvm] [CGData][ThinLTO][NFC] Prep for two-codegen rounds (PR #90934)

2024-09-16 Thread Mingming Liu via cfe-commits
@@ -56,6 +56,7 @@ Error thinBackend(const Config &C, unsigned Task, AddStreamFn AddStream, const FunctionImporter::ImportMapTy &ImportList, const GVSummaryMapTy &DefinedGlobals, MapVector *ModuleMap, + bool

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

2025-02-10 Thread Mingming Liu via cfe-commits
@@ -0,0 +1,20 @@ +; RUN: llvm-as %s -o - | llvm-dis -o %t.ll +; RUN: grep "^\^" %s >%t2 +; RUN: grep "^\^" %t.ll >%t3 +; Expect that the summary information is the same after round-trip through +; llvm-as and llvm-dis. +; RUN: diff -b %t2 %t3 + +target triple = "aarch64-unknown-li

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

2025-02-10 Thread Mingming Liu via cfe-commits
https://github.com/mingmingl-llvm 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-10 Thread Mingming Liu via cfe-commits
https://github.com/mingmingl-llvm commented: Thanks for the work! Do you have some stats with this change applied? https://github.com/llvm/llvm-project/pull/126336 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [docs]Fix a typo around '#pragma clang section' (PR #119791)

2024-12-12 Thread Mingming Liu via cfe-commits
https://github.com/mingmingl-llvm created https://github.com/llvm/llvm-project/pull/119791 None >From a996d55a1876e53f42978a6ff32fda86c3b062fe Mon Sep 17 00:00:00 2001 From: mingmingl Date: Thu, 12 Dec 2024 16:11:30 -0800 Subject: [PATCH] [docs]Fix a typo around '#pragma clang section' --- c

[clang] [docs]Fix a typo around '#pragma clang section' (PR #119791)

2024-12-12 Thread Mingming Liu via cfe-commits
https://github.com/mingmingl-llvm closed https://github.com/llvm/llvm-project/pull/119791 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add clang driver option -fpartition-static-data-sections (PR #124991)

2025-01-29 Thread Mingming Liu via cfe-commits
https://github.com/mingmingl-llvm created https://github.com/llvm/llvm-project/pull/124991 None >From 755b5d07f8fb792793036179df72eec6bda19260 Mon Sep 17 00:00:00 2001 From: mingmingl Date: Wed, 29 Jan 2025 13:17:11 -0800 Subject: [PATCH 1/2] [Clang]Add -fpartition-static-data-section --- cl

[clang] [NFC]Update -fsplit-machine-functions now aarch64 function splitting is supported (PR #122860)

2025-01-13 Thread Mingming Liu via cfe-commits
https://github.com/mingmingl-llvm created https://github.com/llvm/llvm-project/pull/122860 None >From 4d095938962f078f1b1d6d35c28f5fbae4a1349d Mon Sep 17 00:00:00 2001 From: mingmingl Date: Mon, 13 Jan 2025 21:32:15 -0800 Subject: [PATCH] [NFC]Update -fsplit-machine-functions now aarch64 funct

[clang] [NFC]Update -fsplit-machine-functions now aarch64 function splitting is supported (PR #122860)

2025-01-13 Thread Mingming Liu via cfe-commits
https://github.com/mingmingl-llvm edited https://github.com/llvm/llvm-project/pull/122860 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC]Update -fsplit-machine-functions now aarch64 function splitting is supported (PR #122860)

2025-01-13 Thread Mingming Liu via cfe-commits
https://github.com/mingmingl-llvm closed https://github.com/llvm/llvm-project/pull/122860 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC]Update -fsplit-machine-functions now aarch64 function splitting is supported (PR #122860)

2025-01-13 Thread Mingming Liu via cfe-commits
mingmingl-llvm wrote: thanks for taking a look! https://github.com/llvm/llvm-project/pull/122860 ___ 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-13 Thread Mingming Liu 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-13 Thread Mingming Liu via cfe-commits
https://github.com/mingmingl-llvm 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-13 Thread Mingming Liu via cfe-commits
https://github.com/mingmingl-llvm commented: I tried this patch on an internal data center application and it reduced the `.data.rel.ro` section size by 3.69% and the number of `_ZTS` or `_ZTI` prefixed entries by ~27% ~ 28%. Despite the good size savings, the numbers make me curious about wha

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

2025-02-13 Thread Mingming Liu 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-13 Thread Mingming Liu 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 Mingming Liu via cfe-commits
@@ -0,0 +1,20 @@ +; RUN: llvm-as %s -o - | llvm-dis -o %t.ll +; RUN: grep "^\^" %s >%t2 +; RUN: grep "^\^" %t.ll >%t3 +; Expect that the summary information is the same after round-trip through +; llvm-as and llvm-dis. +; RUN: diff -b %t2 %t3 + +target triple = "aarch64-unknown-li

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

2025-02-19 Thread Mingming Liu via cfe-commits
mingmingl-llvm wrote: > > Taking a further look shows these preserved RTTIs come from vtables whose > > superclass has its type-id accessed. > > Thank you for helping evaluate this patch. I am curious about what these type > IDs is used for—is it for dynamic_cast, exception handling, or the ty

[clang] [Clang] Add clang driver option -fpartition-static-data-sections (PR #124991)

2025-04-10 Thread Mingming Liu via cfe-commits
https://github.com/mingmingl-llvm updated https://github.com/llvm/llvm-project/pull/124991 >From 755b5d07f8fb792793036179df72eec6bda19260 Mon Sep 17 00:00:00 2001 From: mingmingl Date: Wed, 29 Jan 2025 13:17:11 -0800 Subject: [PATCH 1/2] [Clang]Add -fpartition-static-data-section --- clang/in

<    1   2   3   4