[llvm-branch-commits] [llvm] [PowerPC][GlobalMerge] Reduce TOC usage by merging internal and private global data (PR #101224)

Kai Nacke via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jul 30 12:55:39 PDT 2024


================
@@ -720,8 +731,14 @@ bool GlobalMergeImpl::run(Module &M) {
 
 Pass *llvm::createGlobalMergePass(const TargetMachine *TM, unsigned Offset,
                                   bool OnlyOptimizeForSize,
-                                  bool MergeExternalByDefault) {
+                                  bool MergeExternalByDefault,
+                                  bool MergePrivateByDefault,
+                                  bool MergeConstantByDefault) {
   bool MergeExternal = (EnableGlobalMergeOnExternal == cl::BOU_UNSET) ?
     MergeExternalByDefault : (EnableGlobalMergeOnExternal == cl::BOU_TRUE);
-  return new GlobalMerge(TM, Offset, OnlyOptimizeForSize, MergeExternal);
+  bool MergeConstant = EnableGlobalMergeOnConst.getNumOccurrences() > 0
+                           ? EnableGlobalMergeOnConst
+                           : MergeConstantByDefault;
----------------
redstar wrote:

```suggestion
  bool MergeConstant = EnableGlobalMergeOnConst || MergeConstantByDefault;
```

https://github.com/llvm/llvm-project/pull/101224


More information about the llvm-branch-commits mailing list