Skip to content

Check for all frame instructions in finalize isel. #85945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/FinalizeISel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ bool FinalizeISel::runOnMachineFunction(MachineFunction &MF) {

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

// If MI is a pseudo, expand it.
Expand Down
16 changes: 16 additions & 0 deletions llvm/test/CodeGen/SystemZ/frame-adjstack.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
; RUN: llc < %s -mtriple=s390x-linux-gnu -verify-machineinstrs | FileCheck %s
;
; Test that inserting a new MBB near a call during finalize isel custom
; insertion does not cause all frame instructions to be missed. That would
; result in a missing to set the AdjustsStack flag.

; CHECK-LABEL: fun
define void @fun(i1 %cc) {
%sel = select i1 %cc, i32 5, i32 0
tail call void @input_report_abs(i32 %sel)
%sel2 = select i1 %cc, i32 6, i32 1
tail call void @input_report_abs(i32 %sel2)
ret void
}

declare void @input_report_abs(i32)