[llvm-branch-commits] [llvm] [PowerPC][GlobalMerge] Enable GlobalMerge by default on AIX (PR #101226)

Kai Nacke via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 2 06:46:08 PDT 2024


================
@@ -500,7 +500,10 @@ void PPCPassConfig::addIRPasses() {
 }
 
 bool PPCPassConfig::addPreISel() {
-  if (EnableGlobalMerge)
+  if ((EnableGlobalMerge.getNumOccurrences() > 0)
+          ? EnableGlobalMerge
+          : (TM->getTargetTriple().isOSAIX() &&
+             getOptLevel() != CodeGenOptLevel::None))
----------------
redstar wrote:

First thought: there is a slight change in the semantics.
The condition `EnableGlobalMerge.getNumOccurrences() > 0` checks how often the option was specified on the command line. If I specify `-ppc-global-merge=false` then the original `if` returns `false` (because the option was specified 1 time, and it's value is `false` but the value of the changed condition depends on being on AIX or not.

If the former is really the intended functionality then IMHO it warrants a big comment (e.g. "Specifying the command line option overrides AIX default"), just to clarify it.

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


More information about the llvm-branch-commits mailing list