[llvm] [TII] Do not schedule frame-setup/frame-destory instructions (PR #96611)
Haohai Wen via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 25 20:52:34 PDT 2024
https://github.com/HaohaiWen updated https://github.com/llvm/llvm-project/pull/96611
>From 7a8d6a2299a85e4dae192a41ce67042d8a86e583 Mon Sep 17 00:00:00 2001
From: Haohai Wen <haohai.wen at intel.com>
Date: Tue, 25 Jun 2024 17:19:48 +0800
Subject: [PATCH 1/2] [TII] Do not schedule frame-setup/frame-destory
instructions
frame-setup/frame-destroy instruction can not be scheduled around by
PostRAScheduler. Their order is critical for SEH.
---
llvm/lib/CodeGen/TargetInstrInfo.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp
index e01e7b3888915..6a4ed48aed28d 100644
--- a/llvm/lib/CodeGen/TargetInstrInfo.cpp
+++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp
@@ -1383,6 +1383,11 @@ bool TargetInstrInfo::isSchedulingBoundary(const MachineInstr &MI,
if (MI.getOpcode() == TargetOpcode::INLINEASM_BR)
return true;
+ // Frame setup and destory can't be scheduled around.
+ if (MI.getFlag(MachineInstr::FrameSetup) ||
+ MI.getFlag(MachineInstr::FrameDestroy))
+ return true;
+
// Don't attempt to schedule around any instruction that defines
// a stack-oriented pointer, as it's unlikely to be profitable. This
// saves compile time, because it doesn't require every single
>From 460e715bc0ab2841885358cfc5c8d10561c5b4d8 Mon Sep 17 00:00:00 2001
From: Haohai Wen <haohai.wen at intel.com>
Date: Wed, 26 Jun 2024 11:51:18 +0800
Subject: [PATCH 2/2] Limit to X86 only
---
llvm/lib/CodeGen/TargetInstrInfo.cpp | 5 -----
llvm/lib/Target/X86/X86InstrInfo.cpp | 5 +++++
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp
index 6a4ed48aed28d..e01e7b3888915 100644
--- a/llvm/lib/CodeGen/TargetInstrInfo.cpp
+++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp
@@ -1383,11 +1383,6 @@ bool TargetInstrInfo::isSchedulingBoundary(const MachineInstr &MI,
if (MI.getOpcode() == TargetOpcode::INLINEASM_BR)
return true;
- // Frame setup and destory can't be scheduled around.
- if (MI.getFlag(MachineInstr::FrameSetup) ||
- MI.getFlag(MachineInstr::FrameDestroy))
- return true;
-
// Don't attempt to schedule around any instruction that defines
// a stack-oriented pointer, as it's unlikely to be profitable. This
// saves compile time, because it doesn't require every single
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index 1a43d5c17080e..069a1ec9a5988 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -8832,6 +8832,11 @@ bool X86InstrInfo::isSchedulingBoundary(const MachineInstr &MI,
Opcode == X86::PLDTILECFGV)
return true;
+ // Frame setup and destory can't be scheduled around.
+ if (MI.getFlag(MachineInstr::FrameSetup) ||
+ MI.getFlag(MachineInstr::FrameDestroy))
+ return true;
+
return TargetInstrInfo::isSchedulingBoundary(MI, MBB, MF);
}
More information about the llvm-commits
mailing list