200 lines · plain
1; RUN: llc < %s | FileCheck %s2; RUN: llc -O3 < %s | FileCheck %s3; RUN: llc -O3 -debug-only=stackmaps < %s 2>&1 | FileCheck -check-prefix=STACKMAPS %s4; REQUIRES: asserts5 6target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"7target triple = "x86_64-apple-macosx10.11.0"8 9 10; STACKMAPS: Stack Maps: callsite 288240001511; STACKMAPS-NEXT: Stack Maps: has 4 locations12; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]13; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]14; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]15; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]16; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers17; STACKMAPS-NEXT: Stack Maps: callsite 424218; STACKMAPS-NEXT: Stack Maps: has 4 locations19; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]20; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]21; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]22; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]23; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers24; STACKMAPS-NEXT: Stack Maps: callsite 424325; STACKMAPS-NEXT: Stack Maps: has 4 locations26; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]27; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]28; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]29; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 16 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 16]30; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers31; STACKMAPS-NEXT: Stack Maps: callsite 288240001532; STACKMAPS-NEXT: Stack Maps: has 4 locations33; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]34; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]35; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]36; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 2 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 2]37; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers38; STACKMAPS-NEXT: Stack Maps: callsite 288240001539; STACKMAPS-NEXT: Stack Maps: has 4 locations40; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]41; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]42; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]43; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 3 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 3]44; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers45; STACKMAPS-NEXT: Stack Maps: callsite 424346; STACKMAPS-NEXT: Stack Maps: has 4 locations47; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]48; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]49; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]50; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 55 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 55]51; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers52 53declare i32 @callee_0()54declare i32 @callee_1(i32)55declare i32 @callee_vararg(...)56 57define i32 @caller_0() {58; CHECK-LABEL: _caller_059entry:60 %v = call i32 @callee_0() [ "deopt"(i32 0) ]61 %v2 = add i32 %v, 162 ret i32 %v263; CHECK: callq _callee_064; CHECK: incl %eax65; CHECK: retq66}67 68define i32 @caller_1() {69; CHECK-LABEL: _caller_170entry:71 %v = call i32 @callee_1(i32 42) "statepoint-id"="4242" [ "deopt"(i32 1) ]72 ret i32 %v73; CHECK: callq _callee_174; CHECK: popq %rcx75; CHECK: retq76}77 78define i32 @caller_vararg() {79; CHECK-LABEL: _caller_vararg80entry:81; CHECK: movb $1, %al82; CHECK: callq _callee_vararg83 %v = call i32(...) @callee_vararg(i32 42, double 500.0) "statepoint-id"="4243" [ "deopt"(i32 16) ]84 ret i32 %v85}86 87define i32 @invoker_0() personality i8 0 {88; CHECK-LABEL: _invoker_089entry:90 %v = invoke i32 @callee_0() [ "deopt"(i32 2) ]91 to label %normal unwind label %uw92 93normal:94 ret i32 %v95 96uw:97 %ehvals = landingpad { ptr, i32 }98 cleanup99 ret i32 1100; CHECK: callq _callee_0101; CHECK: popq %rcx102; CHECK: retq103; CHECK: movl $1, %eax104; CHECK: popq %rcx105; CHECK: retq106}107 108define i32 @invoker_1() personality i8 0 {109; CHECK-LABEL: _invoker_1110entry:111 %v = invoke i32 @callee_1(i32 45) "statepoint-num-patch-bytes"="9" [ "deopt"(i32 3) ]112 to label %normal unwind label %uw113 114normal:115 ret i32 %v116 117uw:118 %ehvals = landingpad { ptr, i32 }119 cleanup120 ret i32 1121; CHECK: movl $45, %edi122; CHECK: nopw 512(%rax,%rax)123; CHECK: popq %rcx124; CHECK: retq125; CHECK: movl $1, %eax126; CHECK: popq %rcx127; CHECK: retq128}129 130define i32 @invoker_2() personality ptr @__CxxFrameHandler3 {131entry:132 %val = invoke i32 @callee_1(i32 1)133 to label %try.cont unwind label %catch.dispatch134 135catch.dispatch:136 %cs1 = catchswitch within none [label %catch] unwind to caller137 138catch:139 %cp1 = catchpad within %cs1 [ptr null, i32 64, ptr null]140 %val2 = call i32 @callee_1(i32 100) "statepoint-id"="4243" [ "funclet"(token %cp1), "deopt"(i32 55) ]141 catchret from %cp1 to label %try.cont142 143try.cont:144 ret i32 0145}146 147declare i32 @__CxxFrameHandler3(...)148 149define void @f_0(i64 %n) {150 ; CHECK-LABEL: _f_0151 %s = alloca i64152 %vl = alloca i64, i64 %n153 ; Check that the stackmap does not reference %s through154 ; SP since the offset is not static because of %vl.155 ; STACKMAPS: Loc 3: Direct 6156 call void @g_0(ptr %vl) [ "deopt"(ptr %s) ]157 ret void158}159 160declare void @g_0(ptr %vl)161 162define void @vector_deopt_bundle(<32 x ptr addrspace(1)> %val) {163; CHECK-LABEL: _vector_deopt_bundle:164; CHECK: movaps 16(%rbp), %xmm8165; CHECK-NEXT: movaps 32(%rbp), %xmm9166; CHECK-NEXT: movaps 48(%rbp), %xmm10167; CHECK-NEXT: movaps 64(%rbp), %xmm11168; CHECK-NEXT: movaps 80(%rbp), %xmm12169; CHECK-NEXT: movaps 96(%rbp), %xmm13170; CHECK-NEXT: movaps 112(%rbp), %xmm14171; CHECK-NEXT: movaps 128(%rbp), %xmm15172; CHECK-NEXT: movaps %xmm15, 240(%rsp)173; CHECK-NEXT: movaps %xmm14, 224(%rsp)174; CHECK-NEXT: movaps %xmm13, 208(%rsp)175; CHECK-NEXT: movaps %xmm12, 192(%rsp)176; CHECK-NEXT: movaps %xmm11, 176(%rsp)177; CHECK-NEXT: movaps %xmm10, 160(%rsp)178; CHECK-NEXT: movaps %xmm9, 144(%rsp)179; CHECK-NEXT: movaps %xmm8, 128(%rsp)180; CHECK-NEXT: movaps %xmm7, 112(%rsp)181; CHECK-NEXT: movaps %xmm6, 96(%rsp)182; CHECK-NEXT: movaps %xmm5, 80(%rsp)183; CHECK-NEXT: movaps %xmm4, 64(%rsp)184; CHECK-NEXT: movaps %xmm3, 48(%rsp)185; CHECK-NEXT: movaps %xmm2, 32(%rsp)186; CHECK-NEXT: movaps %xmm1, 16(%rsp)187; CHECK-NEXT: movaps %xmm0, (%rsp)188 call void @unknown() [ "deopt"(<32 x ptr addrspace(1)> %val) ]189 ret void190; STACKMAPS: Stack Maps: callsite 2882400015191; STACKMAPS-NEXT: Stack Maps: has 4 locations192; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]193; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]194; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]195; STACKMAPS-NEXT: Stack Maps: Loc 3: Indirect 7+0 [encoding: .byte 3, .byte 0, .short 256, .short 7, .short 0, .int 0]196; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers197}198 199declare void @unknown()200