source: icGREP/icgrep-devel/llvm-3.8.0.src/test/Analysis/ScalarEvolution/trip-count11.ll @ 5027

Last change on this file since 5027 was 5027, checked in by cameron, 3 years ago

Upgrade to llvm 3.8

File size: 2.1 KB
Line 
1; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
2
3target datalayout = "e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6@foo.a = internal constant [8 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7], align 16
7@foo.a_as1 = internal addrspace(1) constant [8 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7], align 16
8
9
10define i32 @foo() nounwind uwtable noinline {
11entry:
12  br label %for.cond
13
14for.cond:                                         ; preds = %for.inc, %entry
15  %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ]
16; CHECK: --> %sum.0{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 28
17  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
18  %cmp = icmp ult i32 %i.0, 8
19  br i1 %cmp, label %for.inc, label %for.end
20
21for.inc:                                          ; preds = %for.cond
22  %idxprom = sext i32 %i.0 to i64
23  %arrayidx = getelementptr inbounds [8 x i32], [8 x i32]* @foo.a, i64 0, i64 %idxprom
24  %0 = load i32, i32* %arrayidx, align 4
25  %add = add nsw i32 %sum.0, %0
26  %inc = add nsw i32 %i.0, 1
27  br label %for.cond
28
29for.end:                                          ; preds = %for.cond
30  ret i32 %sum.0
31}
32
33define i32 @foo_as1() nounwind uwtable noinline {
34entry:
35  br label %for.cond
36
37for.cond:                                         ; preds = %for.inc, %entry
38  %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ]
39; CHECK: --> %sum.0{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 28
40  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
41  %cmp = icmp ult i32 %i.0, 8
42  br i1 %cmp, label %for.inc, label %for.end
43
44for.inc:                                          ; preds = %for.cond
45  %idxprom = sext i32 %i.0 to i64
46  %arrayidx = getelementptr inbounds [8 x i32], [8 x i32] addrspace(1)* @foo.a_as1, i64 0, i64 %idxprom
47  %0 = load i32, i32 addrspace(1)* %arrayidx, align 4
48  %add = add nsw i32 %sum.0, %0
49  %inc = add nsw i32 %i.0, 1
50  br label %for.cond
51
52for.end:                                          ; preds = %for.cond
53  ret i32 %sum.0
54}
55
Note: See TracBrowser for help on using the repository browser.