1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -passes=newgvn -S -o - %s | FileCheck %s
4 ; If a branch has two identical successors, we cannot declare either dead.
6 define void @widget(i1 %p) {
7 ; CHECK-LABEL: define void @widget(
8 ; CHECK-SAME: i1 [[P:%.*]]) {
10 ; CHECK-NEXT: br label [[BB2:%.*]]
12 ; CHECK-NEXT: [[T1:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[T2:%.*]], [[BB7:%.*]] ]
13 ; CHECK-NEXT: [[T2]] = add i64 [[T1]], 1
14 ; CHECK-NEXT: [[T3:%.*]] = icmp ult i64 0, [[T2]]
15 ; CHECK-NEXT: br i1 [[T3]], label [[BB3:%.*]], label [[BB4:%.*]]
17 ; CHECK-NEXT: [[T4:%.*]] = call i64 @f()
18 ; CHECK-NEXT: br label [[BB4]]
20 ; CHECK-NEXT: br i1 [[P]], label [[BB5:%.*]], label [[BB6:%.*]]
22 ; CHECK-NEXT: br i1 true, label [[BB7]], label [[BB7]]
24 ; CHECK-NEXT: br i1 true, label [[BB7]], label [[BB7]]
26 ; CHECK-NEXT: br i1 [[P]], label [[BB2]], label [[BB8:%.*]]
28 ; CHECK-NEXT: ret void
34 %t1 = phi i64 [ 0, %entry ], [ %t5, %bb7 ]
36 %t3 = icmp ult i64 0, %t2
37 br i1 %t3, label %bb3, label %bb4
44 %foo = phi i64 [ %t4, %bb3 ], [ 0, %bb2 ]
45 br i1 %p, label %bb5, label %bb6
48 br i1 true, label %bb7, label %bb7
51 br i1 true, label %bb7, label %bb7
55 br i1 %p, label %bb2, label %bb8