1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -gvn -o - %s | FileCheck %s
3 ; RUN: opt -S -passes=gvn -o - %s | FileCheck %s
5 define i32 @foo(i1 %cond, i32* %q, i32* %p) {
8 ; CHECK-NEXT: [[V0:%.*]] = call i32 @llvm.convergent(i32 0)
9 ; CHECK-NEXT: store i32 [[V0]], i32* [[Q:%.*]], align 4
10 ; CHECK-NEXT: br i1 [[COND:%.*]], label [[PRE:%.*]], label [[MERGE:%.*]]
12 ; CHECK-NEXT: [[T0:%.*]] = load i32, i32* [[P:%.*]], align 4
13 ; CHECK-NEXT: br label [[MERGE]]
15 ; CHECK-NEXT: [[M0:%.*]] = phi i32 [ [[T0]], [[PRE]] ], [ 0, [[ENTRY:%.*]] ]
16 ; CHECK-NEXT: [[R0:%.*]] = call i32 @llvm.convergent(i32 [[M0]])
17 ; CHECK-NEXT: ret i32 [[R0]]
20 %v0 = call i32 @llvm.convergent(i32 0)
21 store i32 %v0, i32* %q
22 br i1 %cond, label %pre, label %merge
25 %t0 = load i32, i32* %p
29 %m0 = phi i32 [ %t0, %pre ], [ 0, %entry ]
30 %r0 = call i32 @llvm.convergent(i32 %m0)
34 declare i32 @llvm.convergent(i32) #0
36 attributes #0 = { convergent nounwind readnone }