1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=i386-apple-darwin -O0 -regalloc=fast | FileCheck %s 3; rdar://6787136 4 5 %struct.X = type { i8, [32 x i8] } 6@llvm.used = appending global [1 x i8*] [i8* bitcast (i32 ()* @z to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] 7 8define i32 @z() nounwind ssp { 9; CHECK-LABEL: z: 10; CHECK: ## %bb.0: ## %entry 11; CHECK-NEXT: pushl %edi 12; CHECK-NEXT: pushl %esi 13; CHECK-NEXT: subl $148, %esp 14; CHECK-NEXT: movl L___stack_chk_guard$non_lazy_ptr, %eax 15; CHECK-NEXT: movl (%eax), %eax 16; CHECK-NEXT: movl %eax, {{[0-9]+}}(%esp) 17; CHECK-NEXT: movb $48, {{[0-9]+}}(%esp) 18; CHECK-NEXT: movb {{[0-9]+}}(%esp), %al 19; CHECK-NEXT: movb %al, {{[0-9]+}}(%esp) 20; CHECK-NEXT: movb $15, {{[0-9]+}}(%esp) 21; CHECK-NEXT: movl %esp, %eax 22; CHECK-NEXT: movl $8, %ecx 23; CHECK-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) ## 4-byte Spill 24; CHECK-NEXT: leal {{[0-9]+}}(%esp), %esi 25; CHECK-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) ## 4-byte Spill 26; CHECK-NEXT: movl %eax, %edi 27; CHECK-NEXT: rep;movsl (%esi), %es:(%edi) 28; CHECK-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi ## 4-byte Reload 29; CHECK-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx ## 4-byte Reload 30; CHECK-NEXT: movl %eax, %edi 31; CHECK-NEXT: addl $36, %edi 32; CHECK-NEXT: rep;movsl (%esi), %es:(%edi) 33; CHECK-NEXT: movb {{[0-9]+}}(%esp), %cl 34; CHECK-NEXT: movb %cl, 32(%eax) 35; CHECK-NEXT: movb %cl, 68(%eax) 36; CHECK-NEXT: calll _f 37; CHECK-NEXT: movl %eax, {{[0-9]+}}(%esp) 38; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax 39; CHECK-NEXT: movl %eax, {{[0-9]+}}(%esp) 40; CHECK-NEXT: ## %bb.1: ## %return 41; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax 42; CHECK-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) ## 4-byte Spill 43; CHECK-NEXT: movl L___stack_chk_guard$non_lazy_ptr, %eax 44; CHECK-NEXT: movl (%eax), %eax 45; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx 46; CHECK-NEXT: cmpl %ecx, %eax 47; CHECK-NEXT: jne LBB0_3 48; CHECK-NEXT: ## %bb.2: ## %SP_return 49; CHECK-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax ## 4-byte Reload 50; CHECK-NEXT: addl $148, %esp 51; CHECK-NEXT: popl %esi 52; CHECK-NEXT: popl %edi 53; CHECK-NEXT: retl 54; CHECK-NEXT: LBB0_3: ## %CallStackCheckFailBlk 55; CHECK-NEXT: calll ___stack_chk_fail 56; CHECK-NEXT: ud2 57entry: 58 %retval = alloca i32 ; <i32*> [#uses=2] 59 %xxx = alloca %struct.X ; <%struct.X*> [#uses=6] 60 %0 = alloca i32 ; <i32*> [#uses=2] 61 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] 62 %1 = getelementptr %struct.X, %struct.X* %xxx, i32 0, i32 1 ; <[32 x i8]*> [#uses=1] 63 %2 = getelementptr [32 x i8], [32 x i8]* %1, i32 0, i32 31 ; <i8*> [#uses=1] 64 store i8 48, i8* %2, align 1 65 %3 = getelementptr %struct.X, %struct.X* %xxx, i32 0, i32 1 ; <[32 x i8]*> [#uses=1] 66 %4 = getelementptr [32 x i8], [32 x i8]* %3, i32 0, i32 31 ; <i8*> [#uses=1] 67 %5 = load i8, i8* %4, align 1 ; <i8> [#uses=1] 68 %6 = getelementptr %struct.X, %struct.X* %xxx, i32 0, i32 1 ; <[32 x i8]*> [#uses=1] 69 %7 = getelementptr [32 x i8], [32 x i8]* %6, i32 0, i32 0 ; <i8*> [#uses=1] 70 store i8 %5, i8* %7, align 1 71 %8 = getelementptr %struct.X, %struct.X* %xxx, i32 0, i32 0 ; <i8*> [#uses=1] 72 store i8 15, i8* %8, align 1 73 %9 = call i32 (...) bitcast (i32 (%struct.X*, %struct.X*)* @f to i32 (...)*)(%struct.X* byval(%struct.X) align 4 %xxx, %struct.X* byval(%struct.X) align 4 %xxx) nounwind ; <i32> [#uses=1] 74 store i32 %9, i32* %0, align 4 75 %10 = load i32, i32* %0, align 4 ; <i32> [#uses=1] 76 store i32 %10, i32* %retval, align 4 77 br label %return 78 79return: ; preds = %entry 80 %retval1 = load i32, i32* %retval ; <i32> [#uses=1] 81 ret i32 %retval1 82} 83 84declare i32 @f(%struct.X* byval(%struct.X) align 4, %struct.X* byval(%struct.X) align 4) nounwind ssp 85