summaryrefslogtreecommitdiffstats
path: root/test/Transforms/SimplifyCFG/PR16069.ll
blob: 0b3d677945130fd94812ebafd301c61551d56176 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
; RUN: opt < %s -simplifycfg -S | FileCheck %s

@b = extern_weak global i32

define i32 @foo(i1 %y) {
; CHECK: define i32 @foo(i1 %y) {
  br i1 %y, label %bb1, label %bb2
bb1:
  br label %bb3
bb2:
  br label %bb3
bb3:
  %cond.i = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb2 ]
; CHECK: phi i32 {{.*}} srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb2
  ret i32 %cond.i
}

define i32 @foo2(i1 %x) {
; CHECK: define i32 @foo2(i1 %x) {
bb0:
  br i1 %x, label %bb1, label %bb2
bb1:
  br label %bb2
bb2:
  %cond = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb0 ]
; CHECK:  %cond = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb0 ]
  ret i32 %cond
}