1; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=ppc64 | FileCheck %s
2target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
3target triple = "powerpc64-unknown-linux-gnu"
4
5define signext i32 @foo() #0 {
6entry:
7  %v = alloca [8200 x i32], align 4
8  %w = alloca [8200 x i32], align 4
9  %q = alloca [8200 x i32], align 4
10  %0 = bitcast [8200 x i32]* %v to i8*
11  call void @llvm.lifetime.start(i64 32800, i8* %0) #0
12  %1 = bitcast [8200 x i32]* %w to i8*
13  call void @llvm.lifetime.start(i64 32800, i8* %1) #0
14  %2 = bitcast [8200 x i32]* %q to i8*
15  call void @llvm.lifetime.start(i64 32800, i8* %2) #0
16  %arraydecay = getelementptr inbounds [8200 x i32], [8200 x i32]* %q, i64 0, i64 0
17  %arraydecay1 = getelementptr inbounds [8200 x i32], [8200 x i32]* %v, i64 0, i64 0
18  %arraydecay2 = getelementptr inbounds [8200 x i32], [8200 x i32]* %w, i64 0, i64 0
19  call void @bar(i32* %arraydecay, i32* %arraydecay1, i32* %arraydecay2) #0
20  %3 = load i32, i32* %arraydecay2, align 4
21  %arrayidx3 = getelementptr inbounds [8200 x i32], [8200 x i32]* %w, i64 0, i64 1
22  %4 = load i32, i32* %arrayidx3, align 4
23
24; CHECK: @foo
25; CHECK-NOT: lwzx
26; CHECK: lwz {{[0-9]+}}, 4([[REG:[0-9]+]])
27; CHECK: lwz {{[0-9]+}}, 0([[REG]])
28; CHECK: blr
29
30  %add = add nsw i32 %4, %3
31  call void @llvm.lifetime.end(i64 32800, i8* %2) #0
32  call void @llvm.lifetime.end(i64 32800, i8* %1) #0
33  call void @llvm.lifetime.end(i64 32800, i8* %0) #0
34  ret i32 %add
35}
36
37declare void @llvm.lifetime.start(i64, i8* nocapture) #0
38
39declare void @bar(i32*, i32*, i32*)
40
41declare void @llvm.lifetime.end(i64, i8* nocapture) #0
42
43attributes #0 = { nounwind }
44