1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=guard-widening,verify < %s | FileCheck %s
3 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
4 target triple = "x86_64-unknown-linux-gnu"
6 ; Make sure GuardWidening moves 'check' instruction before 'wc1' together with its operand - 'zero'.
10 ; CHECK-NEXT: [[ZERO:%.*]] = add i32 0, 0
11 ; CHECK-NEXT: [[WIDE_CHK:%.*]] = icmp ult i32 [[ZERO]], 0
12 ; CHECK-NEXT: [[WC1:%.*]] = call i1 @llvm.experimental.widenable.condition()
13 ; CHECK-NEXT: [[WC2:%.*]] = call i1 @llvm.experimental.widenable.condition()
14 ; CHECK-NEXT: [[CHECK:%.*]] = icmp ult i32 [[ZERO]], 0
15 ; CHECK-NEXT: [[C2:%.*]] = and i1 [[CHECK]], [[WC2]]
16 ; CHECK-NEXT: [[C1:%.*]] = and i1 [[WIDE_CHK]], [[WC1]]
17 ; CHECK-NEXT: br i1 [[C1]], label [[BB6:%.*]], label [[BB9:%.*]]
19 ; CHECK-NEXT: br i1 true, label [[BB7:%.*]], label [[BB8:%.*]]
21 ; CHECK-NEXT: ret void
23 ; CHECK-NEXT: call void (...) @llvm.experimental.deoptimize.isVoid(i32 0) [ "deopt"() ]
24 ; CHECK-NEXT: ret void
26 ; CHECK-NEXT: call void (...) @llvm.experimental.deoptimize.isVoid(i32 0) [ "deopt"() ]
27 ; CHECK-NEXT: ret void
30 %wc1 = call i1 @llvm.experimental.widenable.condition()
31 %wc2 = call i1 @llvm.experimental.widenable.condition()
33 %check = icmp ult i32 %zero, 0
34 %c1 = and i1 %check, %wc1
35 %c2 = and i1 %check, %wc2
36 br i1 %c1, label %bb6, label %bb9
39 br i1 %c2, label %bb7, label %bb8
45 call void (...) @llvm.experimental.deoptimize.isVoid(i32 0) [ "deopt"() ]
49 call void (...) @llvm.experimental.deoptimize.isVoid(i32 0) [ "deopt"() ]
53 declare void @llvm.experimental.deoptimize.isVoid(...)
55 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(inaccessiblemem: readwrite)
56 declare i1 @llvm.experimental.widenable.condition() #0
58 attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(inaccessiblemem: readwrite) }