1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc %s -o - | FileCheck %s
4 ; Previously, we would accidentally leave behind SP adjustments to setup a call
5 ; frame for the musttail call target, and SP adjustments would end up
6 ; unbalanced. Reported as https://crbug.com/1026882.
8 target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32"
9 target triple = "i386-pc-windows-msvc19.16.0"
12 %struct.Args = type { i32, i32, i32, i32, i32 }
14 declare dso_local x86_thiscallcc void @methodWithVtorDisp(i8* nocapture readonly, <{ %struct.Args }>* inalloca(<{ %struct.Args }>))
16 ; Function Attrs: nounwind optsize
17 define dso_local x86_thiscallcc void @methodWithVtorDisp_thunk(i8* %0, <{ %struct.Args }>* inalloca(<{ %struct.Args }>) %1) #0 {
18 ; CHECK-LABEL: methodWithVtorDisp_thunk:
20 ; CHECK-NEXT: pushl %esi
21 ; CHECK-NEXT: movl %ecx, %esi
22 ; CHECK-NEXT: subl -4(%ecx), %esi
23 ; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
24 ; CHECK-NEXT: pushl $_methodWithVtorDisp_thunk
25 ; CHECK-NEXT: calll ___cyg_profile_func_exit
26 ; CHECK-NEXT: addl $8, %esp
27 ; CHECK-NEXT: movl %esi, %ecx
28 ; CHECK-NEXT: popl %esi
29 ; CHECK-NEXT: jmp _methodWithVtorDisp # TAILCALL
30 %3 = getelementptr inbounds i8, i8* %0, i32 -4
31 %4 = bitcast i8* %3 to i32*
32 %5 = load i32, i32* %4, align 4
34 %7 = getelementptr i8, i8* %0, i32 %6
35 %8 = call i8* @llvm.returnaddress(i32 0)
36 call void @__cyg_profile_func_exit(i8* bitcast (void (i8*, <{ %struct.Args }>*)* @methodWithVtorDisp_thunk to i8*), i8* %8)
37 musttail call x86_thiscallcc void @methodWithVtorDisp(i8* %7, <{ %struct.Args }>* inalloca(<{ %struct.Args }>) nonnull %1)
41 declare void @__cyg_profile_func_exit(i8*, i8*)
43 ; Function Attrs: nofree nosync nounwind readnone willreturn
44 declare i8* @llvm.returnaddress(i32 immarg) #1
46 attributes #0 = { nounwind optsize }
47 attributes #1 = { nofree nosync nounwind readnone willreturn }