blob: f6198025b80b50d7db25d7388538248cc41dd41d [file] [log] [blame]
Chris Lattner61321572002-05-20 20:48:24 +00001; This test shows a case where SCCP is incorrectly eliminating the PHI node
2; because it thinks it has a constant 0 value, when it really doesn't.
3
Dan Gohman18800922009-09-11 18:01:28 +00004; RUN: opt < %s -sccp -S | grep phi
Chris Lattner61321572002-05-20 20:48:24 +00005
Tanya Lattner1d526b92008-03-19 04:14:49 +00006define i32 @test(i32 %A, i1 %c) {
Chris Lattner61321572002-05-20 20:48:24 +00007bb1:
8 br label %BB2
Tanya Lattner1d526b92008-03-19 04:14:49 +00009BB2: ; preds = %BB4, %bb1
10 %V = phi i32 [ 0, %bb1 ], [ %A, %BB4 ] ; <i32> [#uses=1]
Chris Lattner61321572002-05-20 20:48:24 +000011 br label %BB3
Tanya Lattner1d526b92008-03-19 04:14:49 +000012BB3: ; preds = %BB2
13 br i1 %c, label %BB4, label %BB5
14BB4: ; preds = %BB3
Chris Lattner61321572002-05-20 20:48:24 +000015 br label %BB2
Tanya Lattner1d526b92008-03-19 04:14:49 +000016BB5: ; preds = %BB3
17 ret i32 %V
Chris Lattner61321572002-05-20 20:48:24 +000018}
Tanya Lattner1d526b92008-03-19 04:14:49 +000019