1 ; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -o - %s | FileCheck %s
3 %struct_type = type { [10000 x i32], i32, i32 }
5 define void @test1(%struct_type** %s, i32 %n) {
8 %struct = load %struct_type*, %struct_type** %s
12 %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
13 ; CHECK: mov w{{[0-9]+}}, #40000
14 ; CHECK-NOT: mov w{{[0-9]+}}, #40004
15 %gep0 = getelementptr %struct_type, %struct_type* %struct, i64 0, i32 1
16 %gep1 = getelementptr %struct_type, %struct_type* %struct, i64 0, i32 2
17 %cmp = icmp slt i32 %phi, %n
18 br i1 %cmp, label %while_body, label %while_end
21 ; CHECK: str w{{[0-9]+}}, [x{{[0-9]+}}, #4]
23 store i32 %i, i32* %gep0
24 store i32 %phi, i32* %gep1
31 define void @test2(%struct_type* %struct, i32 %n) {
34 %cmp = icmp eq %struct_type* %struct, null
35 br i1 %cmp, label %while_end, label %while_cond
38 %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
39 ; CHECK: mov w{{[0-9]+}}, #40000
40 ; CHECK-NOT: mov w{{[0-9]+}}, #40004
41 %gep0 = getelementptr %struct_type, %struct_type* %struct, i64 0, i32 1
42 %gep1 = getelementptr %struct_type, %struct_type* %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 w{{[0-9]+}}, [x{{[0-9]+}}, #4]
49 store i32 %i, i32* %gep0
50 store i32 %phi, i32* %gep1
57 define void @test3(%struct_type* %s1, %struct_type* %s2, i1 %cond, i32 %n) {
60 br i1 %cond, label %if_true, label %if_end
66 %struct = phi %struct_type* [ %s1, %entry ], [ %s2, %if_true ]
67 %cmp = icmp eq %struct_type* %struct, null
68 br i1 %cmp, label %while_end, label %while_cond
71 %phi = phi i32 [ 0, %if_end ], [ %i, %while_body ]
72 ; CHECK: mov w{{[0-9]+}}, #40000
73 ; CHECK-NOT: mov w{{[0-9]+}}, #40004
74 %gep0 = getelementptr %struct_type, %struct_type* %struct, i64 0, i32 1
75 %gep1 = getelementptr %struct_type, %struct_type* %struct, i64 0, i32 2
76 %cmp1 = icmp slt i32 %phi, %n
77 br i1 %cmp1, label %while_body, label %while_end
80 ; CHECK: str w{{[0-9]+}}, [x{{[0-9]+}}, #4]
82 store i32 %i, i32* %gep0
83 store i32 %phi, i32* %gep1
90 declare %struct_type* @foo()
93 define void @test4(i32 %n) personality i32 (...)* @__FrameHandler {
99 %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
100 %struct = invoke %struct_type* @foo() to label %while_cond_x unwind label %cleanup
103 ; CHECK: mov w{{[0-9]+}}, #40000
104 ; CHECK-NOT: mov w{{[0-9]+}}, #40004
105 %gep0 = getelementptr %struct_type, %struct_type* %struct, i64 0, i32 1
106 %gep1 = getelementptr %struct_type, %struct_type* %struct, i64 0, i32 2
107 store i32 0, i32* %gep0
108 %cmp = icmp slt i32 %phi, %n
109 br i1 %cmp, label %while_body, label %while_end
112 ; CHECK: str w{{[0-9]+}}, [x{{[0-9]+}}, #4]
114 store i32 %i, i32* %gep0
115 store i32 %phi, i32* %gep1
122 %x10 = landingpad { i8*, i32 }
125 resume { i8*, i32 } %x10
128 declare i32 @__FrameHandler(...)
130 define void @test5([65536 x i32]** %s, i32 %n) {
133 %struct = load [65536 x i32]*, [65536 x i32]** %s
137 %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
138 ; CHECK: mov w{{[0-9]+}}, #14464
139 ; CHECK-NOT: mov w{{[0-9]+}}, #14468
140 %gep0 = getelementptr [65536 x i32], [65536 x i32]* %struct, i64 0, i32 20000
141 %gep1 = getelementptr [65536 x i32], [65536 x i32]* %struct, i64 0, i32 20001
142 %cmp = icmp slt i32 %phi, %n
143 br i1 %cmp, label %while_body, label %while_end
146 ; CHECK: str w{{[0-9]+}}, [x{{[0-9]+}}, #4]
148 store i32 %i, i32* %gep0
149 store i32 %phi, i32* %gep1
156 declare i8* @llvm.strip.invariant.group.p0i8(i8*)
158 define void @test_invariant_group(i32) {
159 ; CHECK-LABEL: test_invariant_group
160 br i1 undef, label %8, label %7
162 ; <label>:2: ; preds = %8, %2
163 br i1 undef, label %2, label %7
165 ; <label>:3: ; preds = %8
166 %4 = getelementptr inbounds i8, i8* %9, i32 40000
167 %5 = bitcast i8* %4 to i64*
168 br i1 undef, label %7, label %6
170 ; <label>:6: ; preds = %3
171 store i64 1, i64* %5, align 8
174 ; <label>:7: ; preds = %6, %3, %2, %1
177 ; <label>:8: ; preds = %1
178 %9 = call i8* @llvm.strip.invariant.group.p0i8(i8* nonnull undef)
179 %10 = icmp eq i32 %0, 0
180 br i1 %10, label %3, label %2