• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by update_test_checks.py
2; RUN: opt < %s -simplifycfg -S | FileCheck %s
3
4@b = extern_weak global i32
5
6define i32 @foo(i1 %y) {
7; CHECK-LABEL: @foo(
8; CHECK:         [[COND_I:%.*]] = phi i32 [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb2 ], [ 0, %0 ]
9; CHECK-NEXT:    ret i32 [[COND_I]]
10;
11  br i1 %y, label %bb1, label %bb2
12bb1:
13  br label %bb3
14bb2:
15  br label %bb3
16bb3:
17  %cond.i = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb2 ]
18  ret i32 %cond.i
19}
20
21define i32 @foo2(i1 %x) {
22; CHECK-LABEL: @foo2(
23; CHECK:         [[COND:%.*]] = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb0 ]
24; CHECK-NEXT:    ret i32 [[COND]]
25;
26bb0:
27  br i1 %x, label %bb1, label %bb2
28bb1:
29  br label %bb2
30bb2:
31  %cond = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb0 ]
32  ret i32 %cond
33}
34