From 769ced3d576bef1098c1e5819d4afeb9eee4d6bd Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Mon, 17 May 2021 11:34:16 +0100 Subject: [PATCH] AArch64: mark x22 livein if it's an async context that gets stored. This fixes a crash with expensive checks enabled (the verifier was not happy). --- llvm/lib/Target/AArch64/AArch64FrameLowering.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp index 64ad462..7ef3007 100644 --- a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp @@ -1270,7 +1270,8 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF, // record, so store it now. const auto &Attrs = MF.getFunction().getAttributes(); bool HaveInitialContext = Attrs.hasAttrSomewhere(Attribute::SwiftAsync); - + if (HaveInitialContext) + MBB.addLiveIn(AArch64::X22); BuildMI(MBB, MBBI, DL, TII->get(AArch64::StoreSwiftAsyncContext)) .addUse(HaveInitialContext ? AArch64::X22 : AArch64::XZR) .addUse(AArch64::SP) -- 2.7.4