; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s declare void @use(i1) define i1 @test_uge_temporary_indices_decompose(i8 %start, i8 %n, i8 %idx) { ; CHECK-LABEL: @test_uge_temporary_indices_decompose( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP_PRE:%.*]] = icmp ult i8 [[IDX:%.*]], [[N:%.*]] ; CHECK-NEXT: [[START_ADD_IDX:%.*]] = add nuw nsw i8 [[START:%.*]], [[IDX]] ; CHECK-NEXT: [[START_ADD_N:%.*]] = add nuw nsw i8 [[START]], [[N]] ; CHECK-NEXT: [[START_ADD_1:%.*]] = add nuw nsw i8 [[START]], 1 ; CHECK-NEXT: br i1 [[CMP_PRE]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] ; CHECK: if.then: ; CHECK-NEXT: [[T_0:%.*]] = icmp ult i8 [[START_ADD_IDX]], [[START_ADD_N]] ; CHECK-NEXT: [[F_0:%.*]] = icmp uge i8 [[START_ADD_IDX]], [[START_ADD_N]] ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, false ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[START_ADD_1]], [[START_ADD_N]] ; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_1]] ; CHECK-NEXT: [[C_2:%.*]] = icmp ult i8 [[START_ADD_IDX]], [[START_ADD_1]] ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_2]] ; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: if.end: ; CHECK-NEXT: [[F_1:%.*]] = icmp ult i8 [[START_ADD_IDX]], [[START_ADD_N]] ; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[START_ADD_IDX]], [[START_ADD_N]] ; CHECK-NEXT: [[R_4:%.*]] = xor i1 false, true ; CHECK-NEXT: [[C_3:%.*]] = icmp ult i8 [[START_ADD_1]], [[START_ADD_N]] ; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_3]] ; CHECK-NEXT: [[C_4:%.*]] = icmp ult i8 [[START_ADD_IDX]], [[START_ADD_1]] ; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_4]] ; CHECK-NEXT: ret i1 [[R_6]] ; entry: %cmp.pre = icmp ult i8 %idx, %n %start.add.idx = add nuw nsw i8 %start, %idx %start.add.n = add nuw nsw i8 %start, %n %start.add.1 = add nuw nsw i8 %start, 1 br i1 %cmp.pre, label %if.then, label %if.end if.then: ; preds = %entry %t.0 = icmp ult i8 %start.add.idx, %start.add.n %f.0 = icmp uge i8 %start.add.idx, %start.add.n %r.1 = xor i1 %t.0, %f.0 %c.1 = icmp ult i8 %start.add.1, %start.add.n %r.2 = xor i1 %r.1, %c.1 %c.2 = icmp ult i8 %start.add.idx, %start.add.1 %r.3 = xor i1 %r.2, %c.2 ret i1 %r.3 if.end: ; preds = %entry %f.1 = icmp ult i8 %start.add.idx, %start.add.n %t.1 = icmp uge i8 %start.add.idx, %start.add.n %r.4 = xor i1 %f.1, %t.1 %c.3 = icmp ult i8 %start.add.1, %start.add.n %r.5 = xor i1 %r.4, %c.3 %c.4 = icmp ult i8 %start.add.idx, %start.add.1 %r.6 = xor i1 %r.5, %c.4 ret i1 %r.6 }