1; 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
5; RUN: opt < %s -adce                    -S | FileCheck %s
6; RUN: opt < %s -adce -adce-remove-loops -S | FileCheck %s
7
8target datalayout = "e-p:32:32"
9
10define void @dead_test8() {
11entry:
12        br label %loopentry
13
14loopentry:              ; preds = %endif, %entry
15        %k.1 = phi i32 [ %k.0, %endif ], [ 0, %entry ]          ; <i32> [#uses=1]
16        br i1 false, label %no_exit, label %return
17
18no_exit:                ; preds = %loopentry
19; CHECK: br label %then
20        br i1 false, label %then, label %else
21
22then:           ; preds = %no_exit
23        br label %endif
24
25else:           ; preds = %no_exit
26        %dec = add i32 %k.1, -1         ; <i32> [#uses=1]
27        br label %endif
28
29endif:          ; preds = %else, %then
30        %k.0 = phi i32 [ %dec, %else ], [ 0, %then ]            ; <i32> [#uses=1]
31        store i32 2, i32* null
32        br label %loopentry
33
34return:         ; preds = %loopentry
35        ret void
36}
37
38