AArch64: mark x22 livein if it's an async context that gets stored.
authorTim Northover <t.p.northover@gmail.com>
Mon, 17 May 2021 10:34:16 +0000 (11:34 +0100)
committerTim Northover <t.p.northover@gmail.com>
Mon, 17 May 2021 10:56:03 +0000 (11:56 +0100)
This fixes a crash with expensive checks enabled (the verifier was not happy).

llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

index 64ad462..7ef3007 100644 (file)
@@ -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)