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

Yaxun Liu via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 12:13:30 PDT 2023


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

>From 2bff6f6e8ffba8745e8b86beb495d21cf693b923 Mon Sep 17 00:00:00 2001
From: "Yaxun (Sam) Liu" <yaxun.liu at amd.com>
Date: Wed, 27 Sep 2023 15:12:10 -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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp
index 05da09002d25514..ec2d010d44b7eb7 100644
--- a/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/llvm/lib/CodeGen/MachineLICM.cpp
@@ -58,6 +58,10 @@ 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 +334,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