aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/SimplifyCFG/2003-08-17-BranchFoldOrdering.ll
blob: 888e187b6b4de770084a3b0be4df30cab9d2eb65 (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
; This test checks to make sure that 'br X, Dest, Dest' is folded into 
; 'br Dest'.  This can only happen after the 'Z' block is eliminated.  This is
; due to the fact that the SimplifyCFG function does not use 
; the ConstantFoldTerminator function.

; RUN: opt < %s -simplifycfg -S | \
; RUN:   not grep {br i1 %c2}

declare void @noop()

define i32 @test(i1 %c1, i1 %c2) {
	call void @noop( )
	br i1 %c1, label %A, label %Y
A:		; preds = %0
	call void @noop( )
	br i1 %c2, label %Z, label %X
Z:		; preds = %A
	br label %X
X:		; preds = %Y, %Z, %A
	call void @noop( )
	ret i32 0
Y:		; preds = %0
	call void @noop( )
	br label %X
}