aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/CorrelatedExprs/looptest.ll
blob: 62a983a5ada1bbbc5769fee6be7868ed351cfe89 (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
; This testcase tests to see if adds and PHI's are handled in their full 
; generality.  This testcase comes from the following C code:
;
; void f() {
;   int i;
;   for (i = 1; i < 100; i++) {
;     if (i)
;       g();
;   }
; }
;
; Note that this is a "feature" test, not a correctness test.
;
; RUN: llvm-as < %s | opt -cee -simplifycfg | llvm-dis | not grep cond213
;
implementation   ; Functions:

declare void %g()

void %f() {
bb0:		; No predecessors!
	br label %bb2

bb2:		; preds = %bb4, %bb0
	%cann-indvar = phi int [ 0, %bb0 ], [ %add1-indvar, %bb4 ]		; <int> [#uses=2]
	%add1-indvar = add int %cann-indvar, 1		; <int> [#uses=2]
	%cond213 = seteq int %add1-indvar, 0		; <bool> [#uses=1]
	br bool %cond213, label %bb4, label %bb3

bb3:		; preds = %bb2
	call void %g( )
	br label %bb4

bb4:		; preds = %bb3, %bb2
	%reg109 = add int %cann-indvar, 2		; <int> [#uses=1]
	%cond217 = setle int %reg109, 99		; <bool> [#uses=1]
	br bool %cond217, label %bb2, label %bb5

bb5:		; preds = %bb4
	ret void
}