1 ; RUN: opt < %s -simplifycfg -S | FileCheck %s 2 3 @b = extern_weak global i32 4 5 define i32 @foo(i1 %y) { 6 ; CHECK: define i32 @foo(i1 %y) { 7 br i1 %y, label %bb1, label %bb2 8 bb1: 9 br label %bb3 10 bb2: 11 br label %bb3 12 bb3: 13 %cond.i = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb2 ] 14 ; CHECK: phi i32 {{.*}} srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb2 15 ret i32 %cond.i 16 } 17 18 define i32 @foo2(i1 %x) { 19 ; CHECK: define i32 @foo2(i1 %x) { 20 bb0: 21 br i1 %x, label %bb1, label %bb2 22 bb1: 23 br label %bb2 24 bb2: 25 %cond = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb0 ] 26 ; CHECK: %cond = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb0 ] 27 ret i32 %cond 28 } 29