54 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s3 4target datalayout = "p:128:64"5 6; Test for 128 bit pointers. At the moment, constraints only support signed i64 offsets.7define i1 @gep_decomp_large_index_63_bits(ptr %a) {8; CHECK-LABEL: @gep_decomp_large_index_63_bits(9; CHECK-NEXT: entry:10; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i64, ptr [[A:%.*]], i64 922337203685477580411; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i64, ptr [[A]], i64 922337203685477580512; CHECK-NEXT: [[NE:%.*]] = icmp ne ptr [[GEP_1]], [[GEP_2]]13; CHECK-NEXT: call void @llvm.assume(i1 [[NE]])14; CHECK-NEXT: [[CMP_ULE:%.*]] = icmp ule ptr [[GEP_1]], [[GEP_2]]15; CHECK-NEXT: [[CMP_UGE:%.*]] = icmp uge ptr [[GEP_1]], [[GEP_2]]16; CHECK-NEXT: [[RES:%.*]] = xor i1 [[CMP_ULE]], [[CMP_ULE]]17; CHECK-NEXT: ret i1 [[RES]]18;19entry:20 %gep.1 = getelementptr inbounds i64, ptr %a, i64 922337203685477580421 %gep.2 = getelementptr inbounds i64, ptr %a, i64 922337203685477580522 %ne = icmp ne ptr %gep.1, %gep.223 call void @llvm.assume(i1 %ne)24 %cmp.ule = icmp ule ptr %gep.1, %gep.225 %cmp.uge = icmp uge ptr %gep.1, %gep.226 %res = xor i1 %cmp.ule, %cmp.ule27 ret i1 %res28}29 30define i1 @gep_decomp_large_index_67_bits(ptr %a) {31; CHECK-LABEL: @gep_decomp_large_index_67_bits(32; CHECK-NEXT: entry:33; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i64, ptr [[A:%.*]], i128 14757395258967641292834; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i64, ptr [[A]], i128 14757395258967641292935; CHECK-NEXT: [[NE:%.*]] = icmp ne ptr [[GEP_1]], [[GEP_2]]36; CHECK-NEXT: call void @llvm.assume(i1 [[NE]])37; CHECK-NEXT: [[CMP_ULE:%.*]] = icmp ule ptr [[GEP_1]], [[GEP_2]]38; CHECK-NEXT: [[CMP_UGE:%.*]] = icmp uge ptr [[GEP_1]], [[GEP_2]]39; CHECK-NEXT: [[RES:%.*]] = xor i1 [[CMP_ULE]], [[CMP_UGE]]40; CHECK-NEXT: ret i1 [[RES]]41;42entry:43 %gep.1 = getelementptr inbounds i64, ptr %a, i128 14757395258967641292844 %gep.2 = getelementptr inbounds i64, ptr %a, i128 14757395258967641292945 %ne = icmp ne ptr %gep.1, %gep.246 call void @llvm.assume(i1 %ne)47 %cmp.ule = icmp ule ptr %gep.1, %gep.248 %cmp.uge = icmp uge ptr %gep.1, %gep.249 %res = xor i1 %cmp.ule, %cmp.uge50 ret i1 %res51}52 53declare void @llvm.assume(i1)54