[llvm] [CGData] Global Merge Functions (PR #112671)

Kyungwoo Lee via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 01:00:31 PST 2024


================
@@ -887,6 +891,9 @@ void TargetPassConfig::addIRPasses() {
   // Convert conditional moves to conditional jumps when profitable.
   if (getOptLevel() != CodeGenOptLevel::None && !DisableSelectOptimize)
     addPass(createSelectOptimizePass());
+
+  if (EnableGlobalMergeFunc)
+    addPass(createGlobalMergeFuncPass());
----------------
kyulee-com wrote:

In the original change of this PR (and the subsequent PR for LLD), I utilized a pre-codegen hook that only applies to an LTO pass. Instead, I have now moved it to `addIRPasses`, which executes IR passes similarly as part of the code generation process. It allows to run this pass for all mode including no-LTO.  In fact, when using separate `-fcodegen-data-generate/-fcodegen-data-use` options, the placement is not critical as long as it remains a late IR pass. However, for the `-codegen-data-thinlto-two-rounds` option, it must be included in the codegen pass like this to ensure that we can execute this IR pass twice when running codegen twice.

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


More information about the llvm-commits mailing list