Akira Hatanaka | ba3af24 | 2014-07-25 19:47:46 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=thumbv7-apple-ios -relocation-model=pic -no-integrated-as | FileCheck %s -check-prefix=PIC |
| 2 | ; RUN: llc < %s -mtriple=thumbv7-apple-ios -relocation-model=static -no-integrated-as | FileCheck %s -check-prefix=STATIC |
Akira Hatanaka | dc08c30 | 2014-08-02 05:40:40 +0000 | [diff] [blame^] | 3 | ; RUN: llc < %s -mtriple=thumbv7-apple-ios -relocation-model=dynamic-no-pic -no-integrated-as | FileCheck %s -check-prefix=DYNAMIC-NO-PIC |
Akira Hatanaka | ba3af24 | 2014-07-25 19:47:46 +0000 | [diff] [blame] | 4 | |
| 5 | ;PIC: foo2 |
| 6 | ;PIC: movw [[R0:r[0-9]+]], :lower16:(L___stack_chk_guard$non_lazy_ptr-([[LABEL0:LPC[0-9_]+]]+4)) |
| 7 | ;PIC: movt [[R0]], :upper16:(L___stack_chk_guard$non_lazy_ptr-([[LABEL0]]+4)) |
| 8 | ;PIC: [[LABEL0]]: |
| 9 | ;PIC: add [[R0]], pc |
| 10 | ;PIC: ldr [[R1:r[0-9]+]], {{\[}}[[R0]]{{\]}} |
| 11 | ;PIC: ldr {{r[0-9]+}}, {{\[}}[[R1]]{{\]}} |
| 12 | |
| 13 | ;STATIC: foo2 |
| 14 | ;STATIC: movw [[R0:r[0-9]+]], :lower16:___stack_chk_guard |
| 15 | ;STATIC: movt [[R0]], :upper16:___stack_chk_guard |
| 16 | ;STATIC: ldr {{r[0-9]+}}, {{\[}}[[R0]]{{\]}} |
| 17 | |
Akira Hatanaka | dc08c30 | 2014-08-02 05:40:40 +0000 | [diff] [blame^] | 18 | ;DYNAMIC-NO-PIC: foo2 |
| 19 | ;DYNAMIC-NO-PIC: movw [[R0:r[0-9]+]], :lower16:L___stack_chk_guard$non_lazy_ptr |
| 20 | ;DYNAMIC-NO-PIC: movt [[R0]], :upper16:L___stack_chk_guard$non_lazy_ptr |
| 21 | ;DYNAMIC-NO-PIC: ldr {{r[0-9]+}}, {{\[}}[[R0]]{{\]}} |
| 22 | |
Akira Hatanaka | ba3af24 | 2014-07-25 19:47:46 +0000 | [diff] [blame] | 23 | ; Function Attrs: nounwind ssp |
| 24 | define i32 @test_stack_guard_remat() #0 { |
| 25 | %a1 = alloca [256 x i32], align 4 |
| 26 | %1 = bitcast [256 x i32]* %a1 to i8* |
| 27 | call void @llvm.lifetime.start(i64 1024, i8* %1) |
| 28 | %2 = getelementptr inbounds [256 x i32]* %a1, i32 0, i32 0 |
| 29 | call void @foo3(i32* %2) #3 |
| 30 | call void asm sideeffect "foo2", "~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{sp},~{lr}"() |
| 31 | call void @llvm.lifetime.end(i64 1024, i8* %1) |
| 32 | ret i32 0 |
| 33 | } |
| 34 | |
| 35 | ; Function Attrs: nounwind |
| 36 | declare void @llvm.lifetime.start(i64, i8* nocapture) |
| 37 | |
| 38 | declare void @foo3(i32*) |
| 39 | |
| 40 | ; Function Attrs: nounwind |
| 41 | declare void @llvm.lifetime.end(i64, i8* nocapture) |
| 42 | |
| 43 | 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" } |