xref: /llvm-project/llvm/test/Transforms/CodeGenPrepare/ARM/splitgep.ll (revision f1ec0d12bb0843f0deab83ef2b5cf1339cbc4f0b)
1; RUN: opt -S -passes='require<profile-summary>,function(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(ptr %sp, ptr %t, i32 %n) {
8; CHECK-LABEL: @test(
9; CHECK-NEXT:  entry:
10; CHECK-NEXT:    %splitgep1 = getelementptr i8, ptr %t, i32 80000
11; CHECK-NEXT:    %s = load ptr, ptr %sp
12; CHECK-NEXT:    %splitgep = getelementptr i8, ptr %s, i32 80000
13entry:
14  %s = load ptr, ptr %sp
15  br label %while_cond
16
17while_cond:
18  %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
19  %gep0 = getelementptr [65536 x i32], ptr %s, i64 0, i32 20000
20  %gep1 = getelementptr [65536 x i32], ptr %s, i64 0, i32 20001
21  %gep2 = getelementptr [65536 x i32], ptr %t, i64 0, i32 20000
22  %gep3 = getelementptr [65536 x i32], ptr %t, i64 0, i32 20001
23  %cmp = icmp slt i32 %phi, %n
24  br i1 %cmp, label %while_body, label %while_end
25
26while_body:
27  %i = add i32 %phi, 1
28  %j = add i32 %phi, 2
29  store i32 %i, ptr %gep0
30  store i32 %phi, ptr %gep1
31  store i32 %i, ptr %gep2
32  store i32 %phi, ptr %gep3
33  br label %while_cond
34
35while_end:
36  ret void
37}
38
39