xref: /aosp_15_r20/external/llvm/test/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; This test shows a case where SCCP is incorrectly eliminating the PHI node
2*9880d681SAndroid Build Coastguard Worker; because it thinks it has a constant 0 value, when it really doesn't.
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -sccp -S | grep phi
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine i32 @test(i32 %A, i1 %c) {
7*9880d681SAndroid Build Coastguard Workerbb1:
8*9880d681SAndroid Build Coastguard Worker	br label %BB2
9*9880d681SAndroid Build Coastguard WorkerBB2:		; preds = %BB4, %bb1
10*9880d681SAndroid Build Coastguard Worker	%V = phi i32 [ 0, %bb1 ], [ %A, %BB4 ]		; <i32> [#uses=1]
11*9880d681SAndroid Build Coastguard Worker	br label %BB3
12*9880d681SAndroid Build Coastguard WorkerBB3:		; preds = %BB2
13*9880d681SAndroid Build Coastguard Worker	br i1 %c, label %BB4, label %BB5
14*9880d681SAndroid Build Coastguard WorkerBB4:		; preds = %BB3
15*9880d681SAndroid Build Coastguard Worker	br label %BB2
16*9880d681SAndroid Build Coastguard WorkerBB5:		; preds = %BB3
17*9880d681SAndroid Build Coastguard Worker	ret i32 %V
18*9880d681SAndroid Build Coastguard Worker}
19*9880d681SAndroid Build Coastguard Worker
20