Skip to content

Conversation

@wangleiat
Copy link
Contributor

This option directly affects the return value of
enableMachineScheduler().

Created using spr 1.3.7
@llvmbot
Copy link
Member

llvmbot commented Oct 13, 2025

@llvm/pr-subscribers-backend-loongarch

Author: wanglei (wangleiat)

Changes

This option directly affects the return value of
enableMachineScheduler().


Full diff: https://github.com/llvm/llvm-project/pull/163150.diff

2 Files Affected:

  • (modified) llvm/lib/Target/LoongArch/LoongArchSubtarget.cpp (+10)
  • (modified) llvm/lib/Target/LoongArch/LoongArchSubtarget.h (+1-1)
diff --git a/llvm/lib/Target/LoongArch/LoongArchSubtarget.cpp b/llvm/lib/Target/LoongArch/LoongArchSubtarget.cpp
index 3acbe4992273a..6463fbb6922f7 100644
--- a/llvm/lib/Target/LoongArch/LoongArchSubtarget.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchSubtarget.cpp
@@ -22,11 +22,21 @@ using namespace llvm;
 #define GET_SUBTARGETINFO_CTOR
 #include "LoongArchGenSubtargetInfo.inc"
 
+static cl::opt<bool>
+    DisableMISched("loongarch-disable-misched", cl::Hidden,
+                   cl::desc("Disable LoongArch MI Scheduling"));
+
 static cl::opt<bool> UseAA("loongarch-use-aa", cl::init(true),
                            cl::desc("Enable the use of AA during codegen."));
 
 void LoongArchSubtarget::anchor() {}
 
+bool LoongArchSubtarget::enableMachineScheduler() const {
+  if (DisableMISched.getNumOccurrences())
+    return !DisableMISched;
+  return true;
+}
+
 // Enable use of alias analysis during code generation (during MI scheduling,
 // DAGCombine, etc.).
 bool LoongArchSubtarget::useAA() const { return UseAA; }
diff --git a/llvm/lib/Target/LoongArch/LoongArchSubtarget.h b/llvm/lib/Target/LoongArch/LoongArchSubtarget.h
index 5e12bafebb0d5..10266e93ee5d6 100644
--- a/llvm/lib/Target/LoongArch/LoongArchSubtarget.h
+++ b/llvm/lib/Target/LoongArch/LoongArchSubtarget.h
@@ -104,7 +104,7 @@ class LoongArchSubtarget : public LoongArchGenSubtargetInfo {
   Align getPrefLoopAlignment() const { return PrefLoopAlignment; }
   unsigned getMaxBytesForAlignment() const { return MaxBytesForAlignment; }
   unsigned getMaxInterleaveFactor() const { return MaxInterleaveFactor; }
-  bool enableMachineScheduler() const override { return true; }
+  bool enableMachineScheduler() const override;
   bool useAA() const override;
 };
 } // end namespace llvm

Copy link
Contributor

@SixWeining SixWeining left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have some tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants