1 ; RUN: llc -mtriple=armv6m-linux-gnueabi -verify-machineinstrs -o - %s -disable-constant-hoisting | FileCheck %s
3 %struct_type = type { [10000 x i32], i32, i32 }
5 define void @test1(ptr %s, i32 %n) {
8 %struct = load ptr, ptr %s
12 %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
13 %gep0 = getelementptr %struct_type, ptr %struct, i64 0, i32 1
14 %gep1 = getelementptr %struct_type, ptr %struct, i64 0, i32 2
15 %cmp = icmp slt i32 %phi, %n
16 br i1 %cmp, label %while_body, label %while_end
19 ; CHECK: str r{{[0-9]+}}, [r{{[0-9]+}}]
20 ; CHECK-NEXT: str r{{[0-9]+}}, [r{{[0-9]+}}, #4]
22 store i32 %i, ptr %gep0
23 store i32 %phi, ptr %gep1
29 ; CHECK-NEXT: .long 40000
33 define void @test2(ptr %struct, i32 %n) {
36 %cmp = icmp eq ptr %struct, null
37 br i1 %cmp, label %while_end, label %while_cond
40 %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
41 %gep0 = getelementptr %struct_type, ptr %struct, i64 0, i32 1
42 %gep1 = getelementptr %struct_type, ptr %struct, i64 0, i32 2
43 %cmp1 = icmp slt i32 %phi, %n
44 br i1 %cmp1, label %while_body, label %while_end
47 ; CHECK: str r{{[0-9]+}}, [r{{[0-9]+}}]
48 ; CHECK-NEXT: str r{{[0-9]+}}, [r{{[0-9]+}}, #4]
50 store i32 %i, ptr %gep0
51 store i32 %phi, ptr %gep1
57 ; CHECK-NEXT: .long 40000
61 define void @test3(ptr %s1, ptr %s2, i1 %cond, i32 %n) {
64 br i1 %cond, label %if_true, label %if_end
70 %struct = phi ptr [ %s1, %entry ], [ %s2, %if_true ]
71 %cmp = icmp eq ptr %struct, null
72 br i1 %cmp, label %while_end, label %while_cond
75 %phi = phi i32 [ 0, %if_end ], [ %i, %while_body ]
76 %gep0 = getelementptr %struct_type, ptr %struct, i64 0, i32 1
77 %gep1 = getelementptr %struct_type, ptr %struct, i64 0, i32 2
78 %cmp1 = icmp slt i32 %phi, %n
79 br i1 %cmp1, label %while_body, label %while_end
82 ; CHECK: str r{{[0-9]+}}, [r{{[0-9]+}}]
83 ; CHECK-NEXT: str r{{[0-9]+}}, [r{{[0-9]+}}, #4]
85 store i32 %i, ptr %gep0
86 store i32 %phi, ptr %gep1
92 ; CHECK-NEXT: .long 40000
98 define void @test4(i32 %n) personality ptr @__FrameHandler {
101 %struct = invoke ptr @foo() to label %while_cond unwind label %cleanup
104 %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
105 %gep0 = getelementptr %struct_type, ptr %struct, i64 0, i32 1
106 %gep1 = getelementptr %struct_type, ptr %struct, i64 0, i32 2
107 %cmp = icmp slt i32 %phi, %n
108 br i1 %cmp, label %while_body, label %while_end
111 ; CHECK: str r{{[0-9]+}}, [r{{[0-9]+}}]
112 ; CHECK-NEXT: str r{{[0-9]+}}, [r{{[0-9]+}}, #4]
114 store i32 %i, ptr %gep0
115 store i32 %phi, ptr %gep1
122 landingpad { ptr, i32 } cleanup
125 ; CHECK-NEXT: .long 40000
129 declare i32 @__FrameHandler(...)
131 define void @test5(ptr %s, i32 %n) {
134 %struct = load ptr, ptr %s
138 %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
139 %gep0 = getelementptr [65536 x i32], ptr %struct, i64 0, i32 20000
140 %gep1 = getelementptr [65536 x i32], ptr %struct, i64 0, i32 20001
141 %cmp = icmp slt i32 %phi, %n
142 br i1 %cmp, label %while_body, label %while_end
145 ; CHECK: str r{{[0-9]+}}, [r{{[0-9]+}}]
146 ; CHECK-NEXT: str r{{[0-9]+}}, [r{{[0-9]+}}, #4]
148 store i32 %i, ptr %gep0
149 store i32 %phi, ptr %gep1
155 ; CHECK-NEXT: .long 80000