44 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s3 4declare void @llvm.assume(i1 noundef) #05 6@arr1 = common global [3 x i16] zeroinitializer, align 27 8define i1 @gep_constexpr_index_lt_upper(i32 noundef %i) {9; CHECK-LABEL: @gep_constexpr_index_lt_upper(10; CHECK-NEXT: entry:11; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[I:%.*]], 312; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]])13; CHECK-NEXT: [[IDXPROM:%.*]] = zext i32 [[I]] to i6414; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i16, ptr @arr1, i64 [[IDXPROM]]15; CHECK-NEXT: ret i1 true16;17entry:18 %cmp = icmp ult i32 %i, 319 call void @llvm.assume(i1 %cmp)20 %idxprom = zext i32 %i to i6421 %upper = getelementptr inbounds i16, ptr @arr1, i64 %idxprom22 %c.1 = icmp ult ptr %upper, getelementptr inbounds ([3 x i16], ptr @arr1, i64 1, i64 0)23 ret i1 %c.124}25 26define i1 @gep_constexpr_index_may_be_gt_upper(i32 noundef %i) {27; CHECK-LABEL: @gep_constexpr_index_may_be_gt_upper(28; CHECK-NEXT: entry:29; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[I:%.*]], 330; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]])31; CHECK-NEXT: [[IDXPROM:%.*]] = zext i32 [[I]] to i6432; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i16, ptr @arr1, i64 [[IDXPROM]]33; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[UPPER]], getelementptr inbounds ([3 x i16], ptr @arr1, i64 0, i64 2)34; CHECK-NEXT: ret i1 [[C_1]]35;36entry:37 %cmp = icmp ult i32 %i, 338 call void @llvm.assume(i1 %cmp)39 %idxprom = zext i32 %i to i6440 %upper = getelementptr inbounds i16, ptr @arr1, i64 %idxprom41 %c.1 = icmp ult ptr %upper, getelementptr inbounds ([3 x i16], ptr @arr1, i64 0, i64 2)42 ret i1 %c.143}44