[llvm] Add option -enable-machine-licm (PR #67589)

Yaxun Liu via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 11:56:53 PDT 2023


https://github.com/yxsamliu created https://github.com/llvm/llvm-project/pull/67589

to facilitate debugging machine LICM related issues. By default it is on.

>From 76f92c66e8a32e476ca134066a24b5e1a741f7ea Mon Sep 17 00:00:00 2001
From: "Yaxun (Sam) Liu" <yaxun.liu at amd.com>
Date: Tue, 26 Sep 2023 14:43:53 -0400
Subject: [PATCH] Add option -enable-machine-licm

to facilitate debugging machine LICM related issues.
By default it is on.
---
 llvm/lib/CodeGen/MachineLICM.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp
index 05da09002d25514..a66e80e11e6bd32 100644
--- a/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/llvm/lib/CodeGen/MachineLICM.cpp
@@ -58,6 +58,11 @@ using namespace llvm;
 
 #define DEBUG_TYPE "machinelicm"
 
+static cl::opt<bool>
+EnableMachineLICM("enable-machine-licm",
+                 cl::desc("Enable MachineLICM"),
+                 cl::init(true), cl::Hidden);
+
 static cl::opt<bool>
 AvoidSpeculation("avoid-speculation",
                  cl::desc("MachineLICM should avoid speculation"),
@@ -330,7 +335,7 @@ INITIALIZE_PASS_END(EarlyMachineLICM, "early-machinelicm",
                     "Early Machine Loop Invariant Code Motion", false, false)
 
 bool MachineLICMBase::runOnMachineFunction(MachineFunction &MF) {
-  if (skipFunction(MF.getFunction()))
+  if (!EnableMachineLICM || skipFunction(MF.getFunction()))
     return false;
 
   Changed = FirstInLoop = false;



More information about the llvm-commits mailing list