1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
4 ; instcombine should sort the PHI operands so that simplifycfg can see the
5 ; duplicate and remove it.
7 define i32 @foo(i1 %t) {
10 ; CHECK-NEXT: call void @bar()
11 ; CHECK-NEXT: br i1 [[T:%.*]], label [[TRUE:%.*]], label [[FALSE:%.*]]
13 ; CHECK-NEXT: call void @bar()
14 ; CHECK-NEXT: br label [[FALSE]]
16 ; CHECK-NEXT: [[A:%.*]] = phi i32 [ 4, [[TRUE]] ], [ 10, [[ENTRY:%.*]] ]
17 ; CHECK-NEXT: call void @bar()
18 ; CHECK-NEXT: ret i32 [[A]]
22 br i1 %t, label %true, label %false
27 %a = phi i32 [ 2, %true ], [ 5, %entry ]
28 %b = phi i32 [ 5, %entry ], [ 2, %true ]