1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=gvn -o - %s | FileCheck %s
4 define i32 @foo(i1 %cond) {
7 ; CHECK-NEXT: [[V0:%.*]] = call i32 @llvm.convergent()
8 ; CHECK-NEXT: br i1 [[COND:%.*]], label [[BODY:%.*]], label [[END:%.*]]
10 ; CHECK-NEXT: [[V1:%.*]] = call i32 @llvm.convergent()
11 ; CHECK-NEXT: br label [[END]]
13 ; CHECK-NEXT: [[RET:%.*]] = phi i32 [ [[V0]], [[ENTRY:%.*]] ], [ [[V1]], [[BODY]] ]
14 ; CHECK-NEXT: ret i32 [[RET]]
17 %v0 = call i32 @llvm.convergent()
18 br i1 %cond, label %body, label %end
21 %v1 = call i32 @llvm.convergent()
25 %ret = phi i32 [ %v0, %entry ], [ %v1, %body ]
29 declare i32 @llvm.convergent() convergent nounwind readnone willreturn