80 lines · plain
1# RUN: llc -mtriple=x86_64 -run-pass none -o - %s | FileCheck %s2# This test ensures that the MIR parser parses the stack protector stack3# object reference in the machine frame info correctly.4 5--- |6 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 17 @__stack_chk_guard = external global ptr8 9 define i32 @test() #0 {10 entry:11 %StackGuardSlot = alloca ptr12 %StackGuard = load ptr, ptr @__stack_chk_guard13 call void @llvm.stackprotector(ptr %StackGuard, ptr %StackGuardSlot)14 %test = alloca ptr, align 815 %a = alloca i8, i64 516 store ptr %a, ptr %test, align 817 %b = load ptr, ptr %test, align 818 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %b)19 call void @llvm.stackprotectorcheck(ptr @__stack_chk_guard)20 ret i32 %call21 }22 23 declare i32 @printf(ptr, ...)24 25 declare void @llvm.stackprotector(ptr, ptr) #126 27 declare void @llvm.stackprotectorcheck(ptr) #228 29 attributes #0 = { ssp "stack-protector-buffer-size"="5" }30 attributes #1 = { nounwind }31 attributes #2 = { nounwind argmemonly }32...33---34name: test35alignment: 1636tracksRegLiveness: true37frameInfo:38 stackSize: 4039 maxAlignment: 840 adjustsStack: true41 hasCalls: true42# CHECK-LABEL: name: test43# CHECK: frameInfo44# CHECK: stackProtector: '%stack.0.StackGuardSlot'45 stackProtector: '%stack.0.StackGuardSlot'46fixedStack:47 - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16,48 callee-saved-register: '$rbx' }49stack:50 - { id: 0, name: StackGuardSlot, offset: -24, size: 8, alignment: 8 }51 - { id: 1, name: test, offset: -40, size: 8, alignment: 8 }52 - { id: 2, name: a, offset: -29, size: 5, alignment: 1 }53body: |54 bb.0.entry:55 successors: %bb.1.entry, %bb.2.entry56 liveins: $rbx, $rbx57 58 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp59 $rsp = frame-setup SUB64ri8 $rsp, 32, implicit-def dead $eflags60 $rbx = LOAD_STACK_GUARD :: (invariant load (s64) from @__stack_chk_guard)61 MOV64mr $rsp, 1, _, 24, _, $rbx62 $rsi = LEA64r $rsp, 1, _, 19, _63 MOV64mr $rsp, 1, _, 8, _, $rsi64 $rdi = LEA64r $rip, 1, _, @.str, _65 dead $eax = MOV32r0 implicit-def dead $eflags, implicit-def $al66 CALL64pcrel32 @printf, csr_64, implicit $rsp, implicit $rdi, implicit $rsi, implicit $al, implicit-def $rsp, implicit-def $eax67 CMP64rm killed $rbx, $rsp, 1, _, 24, _, implicit-def $eflags68 JCC_1 %bb.2.entry, 5, implicit $eflags69 70 bb.1.entry:71 liveins: $eax72 73 $rsp = ADD64ri8 $rsp, 32, implicit-def dead $eflags74 $rbx = POP64r implicit-def $rsp, implicit $rsp75 RET64 $eax76 77 bb.2.entry:78 CALL64pcrel32 &__stack_chk_fail, csr_64, implicit $rsp, implicit-def $rsp79...80