aboutsummaryrefslogtreecommitdiffstats
path: root/test/Analysis/ScalarEvolution/sext-iv-1.ll
blob: ca6ad0aaba12108c7b3afe79c74fcc689666d138 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
; RUN: llvm-as < %s | opt -disable-output -scalar-evolution -analyze \
; RUN:  | grep { -->  (sext i. \{.\*,+,.\*\}<bb1> to i64)} | count 5

; Don't convert (sext {...,+,...}) to {sext(...),+,sext(...)} in cases
; where the trip count is not within range.

target 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"
target triple = "x86_64-unknown-linux-gnu"

define void @foo0(double* nocapture %x) nounwind {
bb1.thread:
	br label %bb1

bb1:		; preds = %bb1, %bb1.thread
	%i.0.reg2mem.0 = phi i64 [ -128, %bb1.thread ], [ %8, %bb1 ]		; <i64> [#uses=3]
	%0 = trunc i64 %i.0.reg2mem.0 to i7		; <i8> [#uses=1]
	%1 = trunc i64 %i.0.reg2mem.0 to i9		; <i8> [#uses=1]
	%2 = sext i9 %1 to i64		; <i64> [#uses=1]
	%3 = getelementptr double* %x, i64 %2		; <double*> [#uses=1]
	%4 = load double* %3, align 8		; <double> [#uses=1]
	%5 = fmul double %4, 3.900000e+00		; <double> [#uses=1]
	%6 = sext i7 %0 to i64		; <i64> [#uses=1]
	%7 = getelementptr double* %x, i64 %6		; <double*> [#uses=1]
	store double %5, double* %7, align 8
	%8 = add i64 %i.0.reg2mem.0, 1		; <i64> [#uses=2]
	%9 = icmp sgt i64 %8, 127		; <i1> [#uses=1]
	br i1 %9, label %return, label %bb1

return:		; preds = %bb1
	ret void
}

define void @foo1(double* nocapture %x) nounwind {
bb1.thread:
	br label %bb1

bb1:		; preds = %bb1, %bb1.thread
	%i.0.reg2mem.0 = phi i64 [ -128, %bb1.thread ], [ %8, %bb1 ]		; <i64> [#uses=3]
	%0 = trunc i64 %i.0.reg2mem.0 to i8		; <i8> [#uses=1]
	%1 = trunc i64 %i.0.reg2mem.0 to i9		; <i8> [#uses=1]
	%2 = sext i9 %1 to i64		; <i64> [#uses=1]
	%3 = getelementptr double* %x, i64 %2		; <double*> [#uses=1]
	%4 = load double* %3, align 8		; <double> [#uses=1]
	%5 = fmul double %4, 3.900000e+00		; <double> [#uses=1]
	%6 = sext i8 %0 to i64		; <i64> [#uses=1]
	%7 = getelementptr double* %x, i64 %6		; <double*> [#uses=1]
	store double %5, double* %7, align 8
	%8 = add i64 %i.0.reg2mem.0, 1		; <i64> [#uses=2]
	%9 = icmp sgt i64 %8, 128		; <i1> [#uses=1]
	br i1 %9, label %return, label %bb1

return:		; preds = %bb1
	ret void
}

define void @foo2(double* nocapture %x) nounwind {
bb1.thread:
	br label %bb1

bb1:		; preds = %bb1, %bb1.thread
	%i.0.reg2mem.0 = phi i64 [ -129, %bb1.thread ], [ %8, %bb1 ]		; <i64> [#uses=3]
	%0 = trunc i64 %i.0.reg2mem.0 to i8		; <i8> [#uses=1]
	%1 = trunc i64 %i.0.reg2mem.0 to i9		; <i8> [#uses=1]
	%2 = sext i9 %1 to i64		; <i64> [#uses=1]
	%3 = getelementptr double* %x, i64 %2		; <double*> [#uses=1]
	%4 = load double* %3, align 8		; <double> [#uses=1]
	%5 = fmul double %4, 3.900000e+00		; <double> [#uses=1]
	%6 = sext i8 %0 to i64		; <i64> [#uses=1]
	%7 = getelementptr double* %x, i64 %6		; <double*> [#uses=1]
	store double %5, double* %7, align 8
	%8 = add i64 %i.0.reg2mem.0, 1		; <i64> [#uses=2]
	%9 = icmp sgt i64 %8, 127		; <i1> [#uses=1]
	br i1 %9, label %return, label %bb1

return:		; preds = %bb1
	ret void
}

define void @foo3(double* nocapture %x) nounwind {
bb1.thread:
	br label %bb1

bb1:		; preds = %bb1, %bb1.thread
	%i.0.reg2mem.0 = phi i64 [ -128, %bb1.thread ], [ %8, %bb1 ]		; <i64> [#uses=3]
	%0 = trunc i64 %i.0.reg2mem.0 to i8		; <i8> [#uses=1]
	%1 = trunc i64 %i.0.reg2mem.0 to i9		; <i8> [#uses=1]
	%2 = sext i9 %1 to i64		; <i64> [#uses=1]
	%3 = getelementptr double* %x, i64 %2		; <double*> [#uses=1]
	%4 = load double* %3, align 8		; <double> [#uses=1]
	%5 = fmul double %4, 3.900000e+00		; <double> [#uses=1]
	%6 = sext i8 %0 to i64		; <i64> [#uses=1]
	%7 = getelementptr double* %x, i64 %6		; <double*> [#uses=1]
	store double %5, double* %7, align 8
	%8 = add i64 %i.0.reg2mem.0, -1		; <i64> [#uses=2]
	%9 = icmp sgt i64 %8, 127		; <i1> [#uses=1]
	br i1 %9, label %return, label %bb1

return:		; preds = %bb1
	ret void
}