1; RUN: opt -S -codegenprepare %s | FileCheck %s
2
3target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
4target triple = "thumbv6m-arm-none-eabi"
5
6; Check that we have deterministic output
7define void @test([65536 x i32]** %sp, [65536 x i32]* %t, i32 %n) {
8; CHECK-LABEL: @test(
9; CHECK-NEXT:  entry:
10; CHECK-NEXT:    %0 = bitcast [65536 x i32]* %t to i8*
11; CHECK-NEXT:    %splitgep1 = getelementptr i8, i8* %0, i32 80000
12; CHECK-NEXT:    %s = load [65536 x i32]*, [65536 x i32]** %sp
13; CHECK-NEXT:    %1 = bitcast [65536 x i32]* %s to i8*
14; CHECK-NEXT:    %splitgep = getelementptr i8, i8* %1, i32 80000
15entry:
16  %s = load [65536 x i32]*, [65536 x i32]** %sp
17  br label %while_cond
18
19while_cond:
20  %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
21  %gep0 = getelementptr [65536 x i32], [65536 x i32]* %s, i64 0, i32 20000
22  %gep1 = getelementptr [65536 x i32], [65536 x i32]* %s, i64 0, i32 20001
23  %gep2 = getelementptr [65536 x i32], [65536 x i32]* %t, i64 0, i32 20000
24  %gep3 = getelementptr [65536 x i32], [65536 x i32]* %t, i64 0, i32 20001
25  %cmp = icmp slt i32 %phi, %n
26  br i1 %cmp, label %while_body, label %while_end
27
28while_body:
29  %i = add i32 %phi, 1
30  %j = add i32 %phi, 2
31  store i32 %i, i32* %gep0
32  store i32 %phi, i32* %gep1
33  store i32 %i, i32* %gep2
34  store i32 %phi, i32* %gep3
35  br label %while_cond
36
37while_end:
38  ret void
39}
40
41