1 ; RUN: opt < %s -passes=lower-switch -S | FileCheck %s
3 ; This test verifies -lower-switch does not crash when an removing an
4 ; unreachable default branch causes a PHI node used as the switch
5 ; condition to be erased.
7 define void @f() local_unnamed_addr {
11 sw.epilog: ; preds = %sw.epilog.outer, %for.body
12 %i = phi i32 [ undef, %for.body ], [ 0, %entry ]
13 br i1 undef, label %for.body, label %for.end
15 for.body: ; preds = %sw.epilog
16 switch i32 %i, label %sw.epilog [
17 i32 0, label %sw.epilog.outer.backedge.loopexit
18 i32 1, label %sw.epilog.outer.backedge
21 sw.epilog.outer.backedge.loopexit: ; preds = %for.body
24 sw.epilog.outer.backedge: ; preds = %for.body
27 for.end: ; preds = %sw.epilog
31 ; The phi and the switch should both be eliminated.