[NFC][RemoveDIs] Prefer iterators over inst-pointers in InstCombine
[llvm-project.git] / llvm / test / CodeGen / Thumb / stack_guard_remat.ll
blob748cc8744d6694f0eeb2097794c38f8eb184f1d8
1 ; RUN: llc < %s -mtriple=thumb-apple-darwin -relocation-model=pic -no-integrated-as | FileCheck %s -check-prefix=PIC
2 ; RUN: llc < %s -mtriple=thumb-apple-darwin -relocation-model=static -no-integrated-as | FileCheck %s -check-prefix=NO-PIC  -check-prefix=STATIC
3 ; RUN: llc < %s -mtriple=thumb-apple-darwin -relocation-model=dynamic-no-pic -no-integrated-as | FileCheck %s  -check-prefix=NO-PIC -check-prefix=DYNAMIC-NO-PIC
5 ;PIC:        foo2
6 ;PIC:        add [[SAVED_GUARD:r[0-9]+]], sp, #904
7 ;PIC-NEXT:   ldr [[SAVED_GUARD]], [[[SAVED_GUARD]], #124]
8 ;PIC-NEXT:   ldr [[ORIGINAL_GUARD:r[0-9]+]], [[ORIGINAL_GUARD_LABEL:LCPI[0-9_]+]]
9 ;PIC-NEXT: [[LABEL1:LPC[0-9_]+]]:
10 ;PIC-NEXT:   add [[ORIGINAL_GUARD]], pc
11 ;PIC-NEXT:   ldr [[ORIGINAL_GUARD]], [[[ORIGINAL_GUARD]]]
12 ;PIC-NEXT:   ldr [[ORIGINAL_GUARD]], [[[ORIGINAL_GUARD]]]
13 ;PIC-NEXT:   cmp [[ORIGINAL_GUARD]], [[SAVED_GUARD]]
15 ;PIC:      [[ORIGINAL_GUARD_LABEL]]:
16 ;PIC-NEXT:   .long L___stack_chk_guard$non_lazy_ptr-([[LABEL1]]+4)
18 ;NO-PIC:   foo2
19 ;NO-PIC:                add [[SAVED_GUARD:r[0-9]+]], sp, #904
20 ;NO-PIC-NEXT:           ldr [[SAVED_GUARD]], [[[SAVED_GUARD]], #124]
21 ;NO-PIC-NEXT:           ldr [[ORIGINAL_GUARD:r[0-9]+]], [[ORIGINAL_GUARD_LABEL:LCPI[0-9_]+]]
22 ;NO-PIC-NOT: LPC
23 ;NO-PIC-NEXT:           ldr [[ORIGINAL_GUARD]], [[[ORIGINAL_GUARD]]]
24 ;DYNAMIC-NO-PIC-NEXT:   ldr [[ORIGINAL_GUARD]], [[[ORIGINAL_GUARD]]]
25 ;NO-PIC-NEXT:           cmp [[ORIGINAL_GUARD]], [[SAVED_GUARD]]
27 ;STATIC:      [[ORIGINAL_GUARD_LABEL]]:
28 ;STATIC-NEXT:   .long ___stack_chk_guard
30 ;DYNAMIC-NO-PIC:      [[ORIGINAL_GUARD_LABEL]]:
31 ;DYNAMIC-NO-PIC-NEXT:   .long L___stack_chk_guard$non_lazy_ptr
33 ; Function Attrs: nounwind ssp
34 define i32 @test_stack_guard_remat() #0 {
35   %a1 = alloca [256 x i32], align 4
36   call void @llvm.lifetime.start.p0(i64 1024, ptr %a1)
37   call void @foo3(ptr %a1) #3
38   call void asm sideeffect "foo2", "~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{sp},~{lr}"()
39   call void @llvm.lifetime.end.p0(i64 1024, ptr %a1)
40   ret i32 0
43 ; Function Attrs: nounwind
44 declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
46 declare void @foo3(ptr)
48 ; Function Attrs: nounwind
49 declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
51 attributes #0 = { nounwind ssp "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
53 !llvm.module.flags = !{!0}
54 !0 = !{i32 7, !"PIC Level", i32 2}