53 lines · plain
1; RUN: llc -mtriple x86_64-unknown-windows-msvc %s -o - | FileCheck %s2 3declare swifttailcc void @callee()4 5define swifttailcc void @swift_tail() {6 call void asm "","~{r14}"()7 tail call swifttailcc void @callee()8 ret void9}10 11; CHECK-LABEL: swift_tail:12; CHECK-NOT: popq %r1413 14define void @has_swift_async(ptr swiftasync %contet) {15 call void asm "","~{r14}"()16 ret void17}18 19; CHECK-LABEL: has_swift_async:20; CHECK: popq %r1421 22; It's impossible to get a tail call from a function without a swiftasync23; parameter to one with unless the CC is swifttailcc. So it doesn't matter24; whether r14 is callee-saved in this case.25define void @calls_swift_async() {26 call void asm "","~{r14}"()27 tail call void @has_swift_async(ptr swiftasync null)28 ret void29}30 31; CHECK-LABEL: calls_swift_async:32; CHECK-NOT: jmpq has_swift_async33 34define swifttailcc void @no_preserve_swiftself() {35 call void asm "","~{r13}"()36 ret void37}38 39; CHECK-LABEL: no_preserve_swiftself:40; CHECK-NOT: popq %r1341 42declare swifttailcc ptr @swift_self(ptr swiftasync %context, ptr swiftself %self)43 44define swiftcc ptr @call_swift_self(ptr swiftself %self, ptr %context) {45 ; call void asm "","~{r13}"()46 ; We get a push r13 but why not with the call below?47 %res = call swifttailcc ptr @swift_self(ptr swiftasync %context, ptr swiftself %self)48 ret ptr %res49}50 51; CHECK-LABEL: call_swift_self:52; CHECK: pushq %r1353