[PATCH] D53878: [AArch64] Mark condition flags as clobbered when calling __chkstk
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 30 11:09:03 PDT 2018
mstorsjo created this revision.
mstorsjo added reviewers: efriedma, mgrang, ssijaric, yinma.
Herald added subscribers: kristof.beyls, javed.absar.
This is similar to SVN r311061 for ARM.
Not sure if this could cause real issues, but fixing just in case.
Repository:
rL LLVM
https://reviews.llvm.org/D53878
Files:
lib/Target/AArch64/AArch64FrameLowering.cpp
test/CodeGen/AArch64/chkstk.ll
Index: test/CodeGen/AArch64/chkstk.ll
===================================================================
--- test/CodeGen/AArch64/chkstk.ll
+++ test/CodeGen/AArch64/chkstk.ll
@@ -1,5 +1,7 @@
; RUN: llc -mtriple=aarch64-windows -verify-machineinstrs %s -o - \
; RUN: | FileCheck -check-prefix CHECK-DEFAULT-CODE-MODEL %s
+; RUN: llc -mtriple=aarch64-windows -print-machineinstrs=prologepilog %s -o - 2>&1 \
+; RUN: | FileCheck -check-prefix CHECK-REGSTATE %s
; RUN: llc -mtriple=aarch64-windows -verify-machineinstrs -code-model=large %s -o - \
; RUN: | FileCheck -check-prefix CHECK-LARGE-CODE-MODEL %s
@@ -23,3 +25,5 @@
; CHECK-LARGE-CODE-MODEL-DAG: add x16, x16, __chkstk
; CHECK-LARGE-CODE-MODEL: blr x16
; CHECK-LARGE-CODE-MODEL: sub sp, sp, x15, lsl #4
+
+; CHECK-REGSTATE: frame-setup BL &__chkstk, implicit-def $lr, implicit $sp, implicit $x15, implicit-def dead $nzcv
Index: lib/Target/AArch64/AArch64FrameLowering.cpp
===================================================================
--- lib/Target/AArch64/AArch64FrameLowering.cpp
+++ lib/Target/AArch64/AArch64FrameLowering.cpp
@@ -731,6 +731,7 @@
BuildMI(MBB, MBBI, DL, TII->get(AArch64::BL))
.addExternalSymbol("__chkstk")
.addReg(AArch64::X15, RegState::Implicit)
+ .addReg(AArch64::NZCV, RegState::Implicit | RegState::Define | RegState::Dead)
.setMIFlags(MachineInstr::FrameSetup);
break;
case CodeModel::Large:
@@ -743,6 +744,7 @@
BuildMI(MBB, MBBI, DL, TII->get(AArch64::BLR))
.addReg(AArch64::X16, RegState::Kill)
.addReg(AArch64::X15, RegState::Implicit | RegState::Define)
+ .addReg(AArch64::NZCV, RegState::Implicit | RegState::Define | RegState::Dead)
.setMIFlags(MachineInstr::FrameSetup);
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53878.171732.patch
Type: text/x-patch
Size: 1818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/4938b359/attachment.bin>
More information about the llvm-commits
mailing list