xref: /llvm-project/llvm/test/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll (revision 8ebb3eac02a926ffa4298c12834c57aefb2e8579)
1cee313d2SEric Christopher; This test shows a case where SCCP is incorrectly eliminating the PHI node
2cee313d2SEric Christopher; because it thinks it has a constant 0 value, when it really doesn't.
3cee313d2SEric Christopher
4*8ebb3eacSBjorn Pettersson; RUN: opt < %s -passes=sccp -S | grep phi
5cee313d2SEric Christopher
6cee313d2SEric Christopherdefine i32 @test(i32 %A, i1 %c) {
7cee313d2SEric Christopherbb1:
8cee313d2SEric Christopher	br label %BB2
9cee313d2SEric ChristopherBB2:		; preds = %BB4, %bb1
10cee313d2SEric Christopher	%V = phi i32 [ 0, %bb1 ], [ %A, %BB4 ]		; <i32> [#uses=1]
11cee313d2SEric Christopher	br label %BB3
12cee313d2SEric ChristopherBB3:		; preds = %BB2
13cee313d2SEric Christopher	br i1 %c, label %BB4, label %BB5
14cee313d2SEric ChristopherBB4:		; preds = %BB3
15cee313d2SEric Christopher	br label %BB2
16cee313d2SEric ChristopherBB5:		; preds = %BB3
17cee313d2SEric Christopher	ret i32 %V
18cee313d2SEric Christopher}
19cee313d2SEric Christopher
20