Skip to content

Commit b4b5e82

Browse files
authored
Check for all frame instructions in finalize isel. (#85945)
Check for all frame instructions in finalize isel, not just for the frame setup opcode. This was proven necessary, see #78001 for discussion.
1 parent 44278f2 commit b4b5e82

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

llvm/lib/CodeGen/FinalizeISel.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ bool FinalizeISel::runOnMachineFunction(MachineFunction &MF) {
5959

6060
// Set AdjustsStack to true if the instruction selector emits a stack
6161
// frame setup instruction or a stack aligning inlineasm.
62-
if (MI.getOpcode() == TII->getCallFrameSetupOpcode() ||
63-
MI.isStackAligningInlineAsm())
62+
if (TII->isFrameInstr(MI) || MI.isStackAligningInlineAsm())
6463
MF.getFrameInfo().setAdjustsStack(true);
6564

6665
// If MI is a pseudo, expand it.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
; RUN: llc < %s -mtriple=s390x-linux-gnu -verify-machineinstrs | FileCheck %s
2+
;
3+
; Test that inserting a new MBB near a call during finalize isel custom
4+
; insertion does not cause all frame instructions to be missed. That would
5+
; result in a missing to set the AdjustsStack flag.
6+
7+
; CHECK-LABEL: fun
8+
define void @fun(i1 %cc) {
9+
%sel = select i1 %cc, i32 5, i32 0
10+
tail call void @input_report_abs(i32 %sel)
11+
%sel2 = select i1 %cc, i32 6, i32 1
12+
tail call void @input_report_abs(i32 %sel2)
13+
ret void
14+
}
15+
16+
declare void @input_report_abs(i32)

0 commit comments

Comments
 (0)