1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -ipsccp -S | FileCheck %s 3 4declare void @use(i1) 5declare void @llvm.assume(i1) 6 7define void @basic(i32 %v) { 8; CHECK-LABEL: @basic( 9; CHECK-NEXT: [[A1:%.*]] = icmp ult i32 [[V:%.*]], 10 10; CHECK-NEXT: call void @llvm.assume(i1 [[A1]]) 11; CHECK-NEXT: [[A2:%.*]] = icmp ugt i32 [[V]], 5 12; CHECK-NEXT: call void @llvm.assume(i1 [[A2]]) 13; CHECK-NEXT: call void @use(i1 true) 14; CHECK-NEXT: [[C2:%.*]] = icmp ult i32 [[V]], 9 15; CHECK-NEXT: call void @use(i1 [[C2]]) 16; CHECK-NEXT: call void @use(i1 false) 17; CHECK-NEXT: [[C4:%.*]] = icmp ugt i32 [[V]], 8 18; CHECK-NEXT: call void @use(i1 [[C4]]) 19; CHECK-NEXT: call void @use(i1 true) 20; CHECK-NEXT: [[C6:%.*]] = icmp ugt i32 [[V]], 6 21; CHECK-NEXT: call void @use(i1 [[C6]]) 22; CHECK-NEXT: call void @use(i1 false) 23; CHECK-NEXT: [[C8:%.*]] = icmp ult i32 [[V]], 7 24; CHECK-NEXT: call void @use(i1 [[C8]]) 25; CHECK-NEXT: ret void 26; 27 %a1 = icmp ult i32 %v, 10 28 call void @llvm.assume(i1 %a1) 29 %a2 = icmp ugt i32 %v, 5 30 call void @llvm.assume(i1 %a2) 31 %c1 = icmp ult i32 %v, 10 32 call void @use(i1 %c1) 33 %c2 = icmp ult i32 %v, 9 34 call void @use(i1 %c2) 35 %c3 = icmp ugt i32 %v, 9 36 call void @use(i1 %c3) 37 %c4 = icmp ugt i32 %v, 8 38 call void @use(i1 %c4) 39 %c5 = icmp ugt i32 %v, 5 40 call void @use(i1 %c5) 41 %c6 = icmp ugt i32 %v, 6 42 call void @use(i1 %c6) 43 %c7 = icmp ult i32 %v, 6 44 call void @use(i1 %c7) 45 %c8 = icmp ult i32 %v, 7 46 call void @use(i1 %c8) 47 ret void 48} 49 50define void @nonnull(i32* %v) { 51; CHECK-LABEL: @nonnull( 52; CHECK-NEXT: [[A:%.*]] = icmp ne i32* [[V:%.*]], null 53; CHECK-NEXT: call void @llvm.assume(i1 [[A]]) 54; CHECK-NEXT: call void @use(i1 false) 55; CHECK-NEXT: call void @use(i1 true) 56; CHECK-NEXT: call void @use(i1 false) 57; CHECK-NEXT: call void @use(i1 true) 58; CHECK-NEXT: ret void 59; 60 %a = icmp ne i32* %v, null 61 call void @llvm.assume(i1 %a) 62 %c1 = icmp eq i32* %v, null 63 call void @use(i1 %c1) 64 %c2 = icmp ne i32* %v, null 65 call void @use(i1 %c2) 66 %c3 = icmp eq i32* null, %v 67 call void @use(i1 %c3) 68 %c4 = icmp ne i32* null, %v 69 call void @use(i1 %c4) 70 ret void 71} 72