1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=guard-widening -S < %s | FileCheck %s
4 define ptr @test(i1 %cond, ptr %p) {
7 ; CHECK-NEXT: [[VAR:%.*]] = call i1 @llvm.experimental.widenable.condition()
8 ; CHECK-NEXT: [[VAR2:%.*]] = call i1 @llvm.experimental.widenable.condition()
9 ; CHECK-NEXT: [[VAR3:%.*]] = and i1 [[COND:%.*]], [[VAR2]]
10 ; CHECK-NEXT: br label [[BB4:%.*]]
12 ; CHECK-NEXT: [[VAR5:%.*]] = load atomic i32, ptr [[P:%.*]] unordered, align 8
13 ; CHECK-NEXT: [[VAR6:%.*]] = icmp ugt i32 [[VAR5]], 0
14 ; CHECK-NEXT: [[VAR7:%.*]] = and i1 [[VAR6]], [[VAR]]
15 ; CHECK-NEXT: br i1 [[VAR7]], label [[BB10:%.*]], label [[BB8:%.*]]
17 ; CHECK-NEXT: [[VAR9:%.*]] = call ptr (...) @llvm.experimental.deoptimize.p0(i32 13) [ "deopt"(i32 0) ]
18 ; CHECK-NEXT: ret ptr [[VAR9]]
20 ; CHECK-NEXT: br i1 [[VAR3]], label [[BB13:%.*]], label [[BB11:%.*]]
22 ; CHECK-NEXT: [[VAR12:%.*]] = call ptr (...) @llvm.experimental.deoptimize.p0(i32 13) [ "deopt"(i32 1) ]
23 ; CHECK-NEXT: ret ptr [[VAR12]]
25 ; CHECK-NEXT: unreachable
28 %var = call i1 @llvm.experimental.widenable.condition()
29 %var2 = call i1 @llvm.experimental.widenable.condition()
30 %var3 = and i1 %cond, %var2
34 %var5 = load atomic i32, ptr %p unordered, align 8
35 %var6 = icmp ugt i32 %var5, 0
36 %var7 = and i1 %var6, %var
37 br i1 %var7, label %bb10, label %bb8
40 %var9 = call ptr (...) @llvm.experimental.deoptimize.p0(i32 13) [ "deopt"(i32 0) ]
44 br i1 %var3, label %bb13, label %bb11
47 %var12 = call ptr (...) @llvm.experimental.deoptimize.p0(i32 13) [ "deopt"(i32 1) ]
54 declare ptr @llvm.experimental.deoptimize.p0(...)
56 declare i1 @llvm.experimental.widenable.condition()