-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate LLVM at llvm/llvm-project@77c780d64b95
Updates LLVM usage to match [77c780d64b95](llvm/llvm-project@77c780d64b95) PiperOrigin-RevId: 720165473
- Loading branch information
1 parent
c8f96a0
commit 8591928
Showing
6 changed files
with
185 additions
and
1,402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,56 @@ | ||
Auto generated patch. Do not edit or delete it, even if empty. | ||
diff -ruN --strip-trailing-cr a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel | ||
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel | ||
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel | ||
@@ -3652,6 +3652,7 @@ | ||
":__support_macros_optimization", | ||
":llvm_libc_types_size_t", | ||
":string_memory_utils", | ||
+ ":types_size_t", | ||
], | ||
) | ||
diff -ruN --strip-trailing-cr a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp | ||
--- a/llvm/lib/CodeGen/GlobalMerge.cpp | ||
+++ b/llvm/lib/CodeGen/GlobalMerge.cpp | ||
@@ -423,12 +423,24 @@ | ||
} | ||
} | ||
|
||
+ // Now we found a bunch of sets of globals used together. We accumulated | ||
+ // the number of times we encountered the sets (i.e., the number of functions | ||
+ // that use that exact set of globals). | ||
+ // | ||
+ // Multiply that by the size of the set to give us a crude profitability | ||
+ // metric. | ||
+ llvm::stable_sort(UsedGlobalSets, | ||
+ [](const UsedGlobalSet &UGS1, const UsedGlobalSet &UGS2) { | ||
+ return UGS1.Globals.count() * UGS1.UsageCount < | ||
+ UGS2.Globals.count() * UGS2.UsageCount; | ||
+ }); | ||
+ | ||
// We can choose to merge all globals together, but ignore globals never used | ||
// with another global. This catches the obviously non-profitable cases of | ||
// having a single global, but is aggressive enough for any other case. | ||
if (GlobalMergeIgnoreSingleUse) { | ||
BitVector AllGlobals(Globals.size()); | ||
- for (const UsedGlobalSet &UGS : UsedGlobalSets) { | ||
+ for (const UsedGlobalSet &UGS : llvm::reverse(UsedGlobalSets)) { | ||
if (UGS.UsageCount == 0) | ||
continue; | ||
if (UGS.Globals.count() > 1) | ||
@@ -437,16 +449,6 @@ | ||
return doMerge(Globals, AllGlobals, M, isConst, AddrSpace); | ||
} | ||
|
||
- // Now we found a bunch of sets of globals used together. We accumulated | ||
- // the number of times we encountered the sets (i.e., the number of functions | ||
- // that use that exact set of globals). Multiply that by the size of the set | ||
- // to give us a crude profitability metric. | ||
- llvm::stable_sort(UsedGlobalSets, | ||
- [](const UsedGlobalSet &UGS1, const UsedGlobalSet &UGS2) { | ||
- return UGS1.Globals.count() * UGS1.UsageCount >= | ||
- UGS2.Globals.count() * UGS2.UsageCount; | ||
- }); | ||
- | ||
// Starting from the sets with the best (=biggest) profitability, find a | ||
// good combination. | ||
// The ideal (and expensive) solution can only be found by trying all | ||
@@ -456,7 +458,7 @@ | ||
BitVector PickedGlobals(Globals.size()); | ||
bool Changed = false; | ||
|
||
- for (const UsedGlobalSet &UGS : UsedGlobalSets) { | ||
+ for (const UsedGlobalSet &UGS : llvm::reverse(UsedGlobalSets)) { | ||
if (UGS.UsageCount == 0) | ||
continue; | ||
if (PickedGlobals.anyCommon(UGS.Globals)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.