[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 02:25:32 PDT 2024


https://github.com/HaohaiWen created https://github.com/llvm/llvm-project/pull/96611

frame-setup/frame-destroy instruction can not be scheduled around by
PostRAScheduler. Their order is critical for SEH.

>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] [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



More information about the llvm-commits mailing list