blob: d30df19fc7c4e6e204e02bc5b7fc17caff8b0821 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; THis testcase caused an assertion failure because a PHI node did not have
2; entries for it's postdominator. But I think this can only happen when the
3; PHI node is dead, so we just avoid patching up dead PHI nodes.
4
Dan Gohman3c7d3082009-09-11 18:01:28 +00005; RUN: opt < %s -adce
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00007target datalayout = "e-p:32:32"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00008
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00009define void @dead_test8() {
10entry:
11 br label %loopentry
Dan Gohmanf17a25c2007-07-18 16:29:46 +000012
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000013loopentry: ; preds = %endif, %entry
14 %k.1 = phi i32 [ %k.0, %endif ], [ 0, %entry ] ; <i32> [#uses=1]
15 br i1 false, label %no_exit, label %return
Dan Gohmanf17a25c2007-07-18 16:29:46 +000016
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000017no_exit: ; preds = %loopentry
18 br i1 false, label %then, label %else
Dan Gohmanf17a25c2007-07-18 16:29:46 +000019
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000020then: ; preds = %no_exit
21 br label %endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +000022
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000023else: ; preds = %no_exit
24 %dec = add i32 %k.1, -1 ; <i32> [#uses=1]
25 br label %endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +000026
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000027endif: ; preds = %else, %then
28 %k.0 = phi i32 [ %dec, %else ], [ 0, %then ] ; <i32> [#uses=1]
29 store i32 2, i32* null
30 br label %loopentry
Dan Gohmanf17a25c2007-07-18 16:29:46 +000031
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000032return: ; preds = %loopentry
33 ret void
Dan Gohmanf17a25c2007-07-18 16:29:46 +000034}
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000035