• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s
2
3
4--- |
5  @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
6  @__stack_chk_guard = external global i8*
7
8  define i32 @test() #0 {
9  entry:
10    %StackGuardSlot = alloca i8*
11    %StackGuard = load i8*, i8** @__stack_chk_guard
12    call void @llvm.stackprotector(i8* %StackGuard, i8** %StackGuardSlot)
13    %test = alloca i8*, align 8
14    %a = alloca i8, i64 5
15    store i8* %a, i8** %test, align 8
16    %b = load i8*, i8** %test, align 8
17    %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %b)
18    call void @llvm.stackprotectorcheck(i8** @__stack_chk_guard)
19    ret i32 %call
20  }
21
22  declare i32 @printf(i8*, ...)
23
24  declare void @llvm.stackprotector(i8*, i8**) #1
25
26  declare void @llvm.stackprotectorcheck(i8**) #2
27
28  attributes #0 = { ssp "stack-protector-buffer-size"="5" }
29  attributes #1 = { nounwind }
30  attributes #2 = { nounwind argmemonly }
31...
32---
33name:            test
34alignment:       4
35tracksRegLiveness: true
36frameInfo:
37  stackSize:       40
38  maxAlignment:    8
39  adjustsStack:    true
40  hasCalls:        true
41# CHECK: [[@LINE+1]]:21: expected a stack object
42  stackProtector:  '0'
43fixedStack:
44  - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16,
45      callee-saved-register: '%rbx' }
46stack:
47  - { id: 0, name: StackGuardSlot, offset: -24, size: 8, alignment: 8 }
48  - { id: 1, name: test, offset: -40, size: 8, alignment: 8 }
49  - { id: 2, name: a, offset: -29, size: 5, alignment: 1 }
50body: |
51  bb.0.entry:
52    liveins: %rbx, %rbx
53
54    frame-setup PUSH64r killed %rbx, implicit-def %rsp, implicit %rsp
55    %rsp = frame-setup SUB64ri8 %rsp, 32, implicit-def dead %eflags
56    %rbx = LOAD_STACK_GUARD :: (invariant load 8 from %ir.__stack_chk_guard)
57    MOV64mr %rsp, 1, _, 24, _, %rbx
58    %rsi = LEA64r %rsp, 1, _, 19, _
59    MOV64mr %rsp, 1, _, 8, _, %rsi
60    %rdi = LEA64r %rip, 1, _, @.str, _
61    dead %eax = MOV32r0 implicit-def dead %eflags, implicit-def %al
62    CALL64pcrel32 @printf, csr_64, implicit %rsp, implicit %rdi, implicit %rsi, implicit %al, implicit-def %rsp, implicit-def %eax
63    CMP64rm killed %rbx, %rsp, 1, _, 24, _, implicit-def %eflags
64    %rsp = ADD64ri8 %rsp, 32, implicit-def dead %eflags
65    %rbx = POP64r implicit-def %rsp, implicit %rsp
66    RETQ %eax
67...
68