brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 1f0146e Raw
37 lines · plain
1; RUN: opt < %s -passes=lower-switch -S | FileCheck %s2 3; This test verifies -lower-switch does not crash when an removing an4; unreachable default branch causes a PHI node used as the switch5; condition to be erased.6 7define void @f() local_unnamed_addr {8entry:9  br label %sw.epilog10 11sw.epilog:                                        ; preds = %sw.epilog.outer, %for.body12  %i = phi i32 [ undef, %for.body ], [ 0, %entry ]13  br i1 true, label %for.body, label %for.end14 15for.body:                                         ; preds = %sw.epilog16  switch i32 %i, label %sw.epilog [17    i32 0, label %sw.epilog.outer.backedge.loopexit18    i32 1, label %sw.epilog.outer.backedge19  ]20 21sw.epilog.outer.backedge.loopexit:                ; preds = %for.body22  br label %for.end23 24sw.epilog.outer.backedge:                         ; preds = %for.body25  unreachable26 27for.end:                                          ; preds = %sw.epilog28  ret void29}30 31; The phi and the switch should both be eliminated.32; CHECK: @f()33; CHECK: sw.epilog:34; CHECK-NOT: phi35; CHECK: for.body:36; CHECK-NOT: switch37