• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -scalar-evolution -analyze -enable-new-pm=0 | FileCheck %s
2; RUN: opt < %s "-passes=print<scalar-evolution>" -disable-output 2>&1 | FileCheck %s
3
4; CHECK: -->  (sext i{{.}} {{{.*}},+,{{.*}}}<%bb1> to i64)
5; CHECK: -->  (sext i{{.}} {{{.*}},+,{{.*}}}<%bb1> to i64)
6; CHECK: -->  (sext i{{.}} {{{.*}},+,{{.*}}}<%bb1> to i64)
7; CHECK: -->  (sext i{{.}} {{{.*}},+,{{.*}}}<%bb1> to i64)
8; CHECK: -->  (sext i{{.}} {{{.*}},+,{{.*}}}<%bb1> to i64)
9; CHECK-NOT: -->  (sext
10
11; Don't convert (sext {...,+,...}) to {sext(...),+,sext(...)} in cases
12; where the trip count is not within range.
13
14target 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-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
15target triple = "x86_64-unknown-linux-gnu"
16
17define void @foo0(double* nocapture %x) nounwind {
18bb1.thread:
19	br label %bb1
20
21bb1:		; preds = %bb1, %bb1.thread
22	%i.0.reg2mem.0 = phi i64 [ -128, %bb1.thread ], [ %8, %bb1 ]		; <i64> [#uses=3]
23	%0 = trunc i64 %i.0.reg2mem.0 to i7		; <i8> [#uses=1]
24	%1 = trunc i64 %i.0.reg2mem.0 to i9		; <i8> [#uses=1]
25	%2 = sext i9 %1 to i64		; <i64> [#uses=1]
26	%3 = getelementptr double, double* %x, i64 %2		; <double*> [#uses=1]
27	%4 = load double, double* %3, align 8		; <double> [#uses=1]
28	%5 = fmul double %4, 3.900000e+00		; <double> [#uses=1]
29	%6 = sext i7 %0 to i64		; <i64> [#uses=1]
30	%7 = getelementptr double, double* %x, i64 %6		; <double*> [#uses=1]
31	store double %5, double* %7, align 8
32	%8 = add i64 %i.0.reg2mem.0, 1		; <i64> [#uses=2]
33	%9 = icmp sgt i64 %8, 127		; <i1> [#uses=1]
34	br i1 %9, label %return, label %bb1
35
36return:		; preds = %bb1
37	ret void
38}
39
40define void @foo1(double* nocapture %x) nounwind {
41bb1.thread:
42	br label %bb1
43
44bb1:		; preds = %bb1, %bb1.thread
45	%i.0.reg2mem.0 = phi i64 [ -128, %bb1.thread ], [ %8, %bb1 ]		; <i64> [#uses=3]
46	%0 = trunc i64 %i.0.reg2mem.0 to i8		; <i8> [#uses=1]
47	%1 = trunc i64 %i.0.reg2mem.0 to i9		; <i8> [#uses=1]
48	%2 = sext i9 %1 to i64		; <i64> [#uses=1]
49	%3 = getelementptr double, double* %x, i64 %2		; <double*> [#uses=1]
50	%4 = load double, double* %3, align 8		; <double> [#uses=1]
51	%5 = fmul double %4, 3.900000e+00		; <double> [#uses=1]
52	%6 = sext i8 %0 to i64		; <i64> [#uses=1]
53	%7 = getelementptr double, double* %x, i64 %6		; <double*> [#uses=1]
54	store double %5, double* %7, align 8
55	%8 = add i64 %i.0.reg2mem.0, 1		; <i64> [#uses=2]
56	%9 = icmp sgt i64 %8, 128		; <i1> [#uses=1]
57	br i1 %9, label %return, label %bb1
58
59return:		; preds = %bb1
60	ret void
61}
62
63define void @foo2(double* nocapture %x) nounwind {
64bb1.thread:
65	br label %bb1
66
67bb1:		; preds = %bb1, %bb1.thread
68	%i.0.reg2mem.0 = phi i64 [ -129, %bb1.thread ], [ %8, %bb1 ]		; <i64> [#uses=3]
69	%0 = trunc i64 %i.0.reg2mem.0 to i8		; <i8> [#uses=1]
70	%1 = trunc i64 %i.0.reg2mem.0 to i9		; <i8> [#uses=1]
71	%2 = sext i9 %1 to i64		; <i64> [#uses=1]
72	%3 = getelementptr double, double* %x, i64 %2		; <double*> [#uses=1]
73	%4 = load double, double* %3, align 8		; <double> [#uses=1]
74	%5 = fmul double %4, 3.900000e+00		; <double> [#uses=1]
75	%6 = sext i8 %0 to i64		; <i64> [#uses=1]
76	%7 = getelementptr double, double* %x, i64 %6		; <double*> [#uses=1]
77	store double %5, double* %7, align 8
78	%8 = add i64 %i.0.reg2mem.0, 1		; <i64> [#uses=2]
79	%9 = icmp sgt i64 %8, 127		; <i1> [#uses=1]
80	br i1 %9, label %return, label %bb1
81
82return:		; preds = %bb1
83	ret void
84}
85
86define void @foo3(double* nocapture %x) nounwind {
87bb1.thread:
88	br label %bb1
89
90bb1:		; preds = %bb1, %bb1.thread
91	%i.0.reg2mem.0 = phi i64 [ -128, %bb1.thread ], [ %8, %bb1 ]		; <i64> [#uses=3]
92	%0 = trunc i64 %i.0.reg2mem.0 to i8		; <i8> [#uses=1]
93	%1 = trunc i64 %i.0.reg2mem.0 to i9		; <i8> [#uses=1]
94	%2 = sext i9 %1 to i64		; <i64> [#uses=1]
95	%3 = getelementptr double, double* %x, i64 %2		; <double*> [#uses=1]
96	%4 = load double, double* %3, align 8		; <double> [#uses=1]
97	%5 = fmul double %4, 3.900000e+00		; <double> [#uses=1]
98	%6 = sext i8 %0 to i64		; <i64> [#uses=1]
99	%7 = getelementptr double, double* %x, i64 %6		; <double*> [#uses=1]
100	store double %5, double* %7, align 8
101	%8 = add i64 %i.0.reg2mem.0, -1		; <i64> [#uses=2]
102	%9 = icmp sgt i64 %8, 127		; <i1> [#uses=1]
103	br i1 %9, label %return, label %bb1
104
105return:		; preds = %bb1
106	ret void
107}
108