• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -indvars -S > %t
2; RUN: grep add %t | count 6
3; RUN: grep sub %t | count 2
4; RUN: grep mul %t | count 6
5
6define void @foo(i64 %n, i64 %m, i64 %o, double* nocapture %p) nounwind {
7entry:
8	%tmp = icmp sgt i64 %n, 0		; <i1> [#uses=1]
9	br i1 %tmp, label %bb.nph, label %return
10
11bb.nph:		; preds = %entry
12	%tmp1 = mul i64 %n, 37		; <i64> [#uses=1]
13	%tmp2 = mul i64 %tmp1, %m		; <i64> [#uses=1]
14	%tmp3 = mul i64 %tmp2, %o		; <i64> [#uses=1]
15	br label %bb
16
17bb:		; preds = %bb, %bb.nph
18	%i.01 = phi i64 [ %tmp3, %bb.nph ], [ %tmp13, %bb ]		; <i64> [#uses=3]
19	%tmp9 = getelementptr double* %p, i64 %i.01		; <double*> [#uses=1]
20	%tmp10 = load double* %tmp9, align 8		; <double> [#uses=1]
21	%tmp11 = fdiv double %tmp10, 2.100000e+00		; <double> [#uses=1]
22	store double %tmp11, double* %tmp9, align 8
23	%tmp13 = add i64 %i.01, 1		; <i64> [#uses=2]
24	%tmp14 = icmp slt i64 %tmp13, %n		; <i1> [#uses=1]
25	br i1 %tmp14, label %bb, label %return.loopexit
26
27return.loopexit:		; preds = %bb
28	br label %return
29
30return:		; preds = %return.loopexit, %entry
31	ret void
32}
33define void @bar(i64 %n, i64 %m, i64 %o, i64 %q, double* nocapture %p) nounwind {
34entry:
35	%tmp = icmp sgt i64 %n, 0		; <i1> [#uses=1]
36	br i1 %tmp, label %bb.nph, label %return
37
38bb.nph:		; preds = %entry
39	%tmp1 = mul i64 %n, %q		; <i64> [#uses=1]
40	%tmp2 = mul i64 %tmp1, %m		; <i64> [#uses=1]
41	%tmp3 = mul i64 %tmp2, %o		; <i64> [#uses=1]
42	br label %bb
43
44bb:		; preds = %bb, %bb.nph
45	%i.01 = phi i64 [ %tmp3, %bb.nph ], [ %tmp13, %bb ]		; <i64> [#uses=3]
46	%tmp9 = getelementptr double* %p, i64 %i.01		; <double*> [#uses=1]
47	%tmp10 = load double* %tmp9, align 8		; <double> [#uses=1]
48	%tmp11 = fdiv double %tmp10, 2.100000e+00		; <double> [#uses=1]
49	store double %tmp11, double* %tmp9, align 8
50	%tmp13 = add i64 %i.01, 1		; <i64> [#uses=2]
51	%tmp14 = icmp slt i64 %tmp13, %n		; <i1> [#uses=1]
52	br i1 %tmp14, label %bb, label %return.loopexit
53
54return.loopexit:		; preds = %bb
55	br label %return
56
57return:		; preds = %return.loopexit, %entry
58	ret void
59}
60