3c69a9de52bbc34e2f12162a941aedf70b6c85b9
[oota-llvm.git] / test / CodeGen / ARM / stack_guard_remat.ll
1 ; RUN: llc < %s -mtriple=arm-apple-ios -relocation-model=pic -no-integrated-as | FileCheck %s -check-prefix=PIC
2 ; RUN: llc < %s -mtriple=arm-apple-ios -relocation-model=static -no-integrated-as | FileCheck %s -check-prefix=STATIC
3
4 ;PIC:   foo2
5 ;PIC:   ldr [[R0:r[0-9]+]], [[LABEL0:LCPI[0-9_]+]]
6 ;PIC: [[LABEL1:LPC0_1]]:
7 ;PIC:   ldr [[R1:r[0-9]+]], [pc, [[R0]]]
8 ;PIC:   ldr [[R2:r[0-9]+]], {{\[}}[[R1]]{{\]}}
9 ;PIC:   ldr {{r[0-9]+}}, {{\[}}[[R2]]{{\]}}
10
11 ;PIC:      [[LABEL0]]:
12 ;PIC-NEXT:   .long L___stack_chk_guard$non_lazy_ptr-([[LABEL1]]+8)
13
14 ;STATIC: foo2
15 ;STATIC: ldr [[R0:r[0-9]+]], [[LABEL0:LCPI[0-9_]+]]
16 ;STATIC: ldr {{r[0-9]+}}, {{\[}}[[R0]]{{\]}}
17
18 ;STATIC:      [[LABEL0]]:
19 ;STATIC-NEXT:   .long ___stack_chk_guard
20
21 ; Function Attrs: nounwind ssp
22 define i32 @test_stack_guard_remat() #0 {
23   %a1 = alloca [256 x i32], align 4
24   %1 = bitcast [256 x i32]* %a1 to i8*
25   call void @llvm.lifetime.start(i64 1024, i8* %1)
26   %2 = getelementptr inbounds [256 x i32]* %a1, i32 0, i32 0
27   call void @foo3(i32* %2) #3
28   call void asm sideeffect "foo2", "~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{sp},~{lr}"()
29   call void @llvm.lifetime.end(i64 1024, i8* %1)
30   ret i32 0
31 }
32
33 ; Function Attrs: nounwind
34 declare void @llvm.lifetime.start(i64, i8* nocapture)
35
36 declare void @foo3(i32*)
37
38 ; Function Attrs: nounwind
39 declare void @llvm.lifetime.end(i64, i8* nocapture)
40
41 attributes #0 = { nounwind ssp "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }