1 ; RUN: opt -S -inline < %s | FileCheck %s
2 ; RUN: opt -S -passes='cgscc(inline)' < %s | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
6 ; Function Attrs: norecurse nounwind uwtable
7 define void @Body(i32* nocapture %res, i32* nocapture readnone %c, i32* nocapture readonly %d, i32* nocapture readonly %p, i32 %i) #0 {
9 %idxprom = sext i32 %i to i64
10 %arrayidx = getelementptr inbounds i32, i32* %p, i64 %idxprom
11 %0 = load i32, i32* %arrayidx, align 4
12 %cmp = icmp eq i32 %0, 0
13 %arrayidx2 = getelementptr inbounds i32, i32* %res, i64 %idxprom
14 %1 = load i32, i32* %arrayidx2, align 4
15 br i1 %cmp, label %cond.end, label %cond.false
17 cond.false: ; preds = %entry
18 %arrayidx6 = getelementptr inbounds i32, i32* %d, i64 %idxprom
19 %2 = load i32, i32* %arrayidx6, align 4
20 %add = add nsw i32 %2, %1
23 cond.end: ; preds = %entry, %cond.false
24 %cond = phi i32 [ %add, %cond.false ], [ %1, %entry ]
25 store i32 %cond, i32* %arrayidx2, align 4
29 ; Function Attrs: nounwind uwtable
30 define void @Test(i32* %res, i32* %c, i32* %d, i32* %p, i32 %n) #1 {
34 for.cond: ; preds = %for.body, %entry
35 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
36 %cmp = icmp slt i32 %i.0, 1600
37 br i1 %cmp, label %for.body, label %for.end
39 for.body: ; preds = %for.cond
40 call void @Body(i32* %res, i32* undef, i32* %d, i32* %p, i32 %i.0), !llvm.access.group !0
41 %inc = add nsw i32 %i.0, 1
42 br label %for.cond, !llvm.loop !1
44 for.end: ; preds = %for.cond
49 ; CHECK: load i32,{{.*}}, !llvm.access.group !0
50 ; CHECK: load i32,{{.*}}, !llvm.access.group !0
51 ; CHECK: load i32,{{.*}}, !llvm.access.group !0
52 ; CHECK: store i32{{.*}}, !llvm.access.group !0
53 ; CHECK: br label %for.cond, !llvm.loop !1
55 attributes #0 = { norecurse nounwind uwtable }
58 !1 = distinct !{!0, !{!"llvm.loop.parallel_accesses", !0}}