blob: 37adba599cd8c173897aaf2212de3c7d0977fcf5 [file] [log] [blame]
Chris Lattnerb093bf32003-04-25 22:53:12 +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
David Callahanebcf9162016-12-13 16:42:18 +00005; RUN: opt < %s -adce -S | FileCheck %s
6; RUN: opt < %s -adce -adce-remove-loops -S | FileCheck %s
Chris Lattnerb093bf32003-04-25 22:53:12 +00007
Tanya Lattner5640bd12008-03-01 09:15:35 +00008target datalayout = "e-p:32:32"
Chris Lattnerb093bf32003-04-25 22:53:12 +00009
Tanya Lattner5640bd12008-03-01 09:15:35 +000010define void @dead_test8() {
11entry:
12 br label %loopentry
Chris Lattnerb093bf32003-04-25 22:53:12 +000013
Tanya Lattner5640bd12008-03-01 09:15:35 +000014loopentry: ; 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
Chris Lattnerb093bf32003-04-25 22:53:12 +000017
Tanya Lattner5640bd12008-03-01 09:15:35 +000018no_exit: ; preds = %loopentry
David Callahanebcf9162016-12-13 16:42:18 +000019; CHECK: br label %then
Tanya Lattner5640bd12008-03-01 09:15:35 +000020 br i1 false, label %then, label %else
Chris Lattnerb093bf32003-04-25 22:53:12 +000021
Tanya Lattner5640bd12008-03-01 09:15:35 +000022then: ; preds = %no_exit
23 br label %endif
Chris Lattnerb093bf32003-04-25 22:53:12 +000024
Tanya Lattner5640bd12008-03-01 09:15:35 +000025else: ; preds = %no_exit
26 %dec = add i32 %k.1, -1 ; <i32> [#uses=1]
27 br label %endif
Chris Lattnerb093bf32003-04-25 22:53:12 +000028
Tanya Lattner5640bd12008-03-01 09:15:35 +000029endif: ; 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
Chris Lattnerb093bf32003-04-25 22:53:12 +000033
Tanya Lattner5640bd12008-03-01 09:15:35 +000034return: ; preds = %loopentry
35 ret void
Chris Lattnerb093bf32003-04-25 22:53:12 +000036}
Tanya Lattner5640bd12008-03-01 09:15:35 +000037