From: Florian Hahn Date: Thu, 26 Aug 2021 12:56:58 +0000 (+0100) Subject: [ConstraintElimination] Rewrite tests to reduce verification complexity. X-Git-Tag: upstream/15.0.7~32960 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0bcfd4cbac66e6216022f51feb38236dc07e333f;p=platform%2Fupstream%2Fllvm.git [ConstraintElimination] Rewrite tests to reduce verification complexity. This patch reduces the bitwidth of types certain tests operate and gets rid of a number of @use(i1) calls and xor's the conditions together instead, which eliminates all timeouts when verifying the tests. See https://github.com/AliveToolkit/alive2/issues/744 for more details. --- diff --git a/llvm/test/Transforms/ConstraintElimination/and.ll b/llvm/test/Transforms/ConstraintElimination/and.ll index 8558ea9..7d2ab0e 100644 --- a/llvm/test/Transforms/ConstraintElimination/and.ll +++ b/llvm/test/Transforms/ConstraintElimination/and.ll @@ -3,145 +3,130 @@ declare void @use(i1) -define i32 @test_and_ule(i32 %x, i32 %y, i32 %z, i32 %a) { +define i1 @test_and_ule(i4 %x, i4 %y, i4 %z, i4 %a) { ; CHECK-LABEL: @test_and_ule( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[Y]], [[Z:%.*]] +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i4 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i4 [[Y]], [[Z:%.*]] ; CHECK-NEXT: [[AND:%.*]] = and i1 [[C_1]], [[C_2]] ; CHECK-NEXT: br i1 [[AND]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[X]], [[Z]] -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i32 [[X]], [[Y]] -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i32 [[Y]], [[Z]] -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[X]], [[A:%.*]] -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: [[T_1:%.*]] = icmp ule i4 [[X]], [[Z]] +; CHECK-NEXT: [[T_2:%.*]] = icmp ule i4 [[X]], [[Y]] +; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, true +; CHECK-NEXT: [[T_3:%.*]] = icmp ule i4 [[Y]], [[Z]] +; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], true +; CHECK-NEXT: [[C_3:%.*]] = icmp ule i4 [[X]], [[A:%.*]] +; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_3]] +; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: exit: -; CHECK-NEXT: [[C_4:%.*]] = icmp ule i32 [[X]], [[Z]] -; CHECK-NEXT: call void @use(i1 [[C_4]]) -; CHECK-NEXT: [[C_5:%.*]] = icmp ule i32 [[X]], [[A]] -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp ule i32 [[X]], [[Y]] -; CHECK-NEXT: call void @use(i1 [[C_6]]) -; CHECK-NEXT: [[C_7:%.*]] = icmp ule i32 [[Y]], [[Z]] -; CHECK-NEXT: call void @use(i1 [[C_7]]) -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: [[C_4:%.*]] = icmp ule i4 [[X]], [[Z]] +; CHECK-NEXT: [[C_5:%.*]] = icmp ule i4 [[X]], [[A]] +; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[C_4]], [[C_5]] +; CHECK-NEXT: [[C_6:%.*]] = icmp ule i4 [[X]], [[Y]] +; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_6]] +; CHECK-NEXT: [[C_7:%.*]] = icmp ule i4 [[Y]], [[Z]] +; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_7]] +; CHECK-NEXT: ret i1 [[R_6]] ; entry: - %c.1 = icmp ule i32 %x, %y - %c.2 = icmp ule i32 %y, %z + %c.1 = icmp ule i4 %x, %y + %c.2 = icmp ule i4 %y, %z %and = and i1 %c.1, %c.2 br i1 %and, label %bb1, label %exit bb1: - %t.1 = icmp ule i32 %x, %z - call void @use(i1 %t.1) + %t.1 = icmp ule i4 %x, %z + %t.2 = icmp ule i4 %x, %y + %r.1 = xor i1 %t.1, %t.2 - %t.2 = icmp ule i32 %x, %y - call void @use(i1 %t.2) + %t.3 = icmp ule i4 %y, %z + %r.2 = xor i1 %r.1, %t.3 - %t.3 = icmp ule i32 %y, %z - call void @use(i1 %t.3) + %c.3 = icmp ule i4 %x, %a + %r.3 = xor i1 %r.2, %c.3 - %c.3 = icmp ule i32 %x, %a - call void @use(i1 %c.3) - - ret i32 10 + ret i1 %r.3 exit: - %c.4 = icmp ule i32 %x, %z - call void @use(i1 %c.4) - - %c.5 = icmp ule i32 %x, %a - call void @use(i1 %c.5) + %c.4 = icmp ule i4 %x, %z + %c.5 = icmp ule i4 %x, %a + %r.4 = xor i1 %c.4, %c.5 - %c.6 = icmp ule i32 %x, %y - call void @use(i1 %c.6) + %c.6 = icmp ule i4 %x, %y + %r.5 = xor i1 %r.4, %c.6 - %c.7 = icmp ule i32 %y, %z - call void @use(i1 %c.7) + %c.7 = icmp ule i4 %y, %z + %r.6 = xor i1 %r.5, %c.7 - ret i32 20 + ret i1 %r.6 } ; The result of test_and_ule and test_and_select_ule should be same -define i32 @test_and_select_ule(i32 %x, i32 %y, i32 %z, i32 %a) { +define i1 @test_and_select_ule(i4 %x, i4 %y, i4 %z, i4 %a) { ; CHECK-LABEL: @test_and_select_ule( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[Y]], [[Z:%.*]] +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i4 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i4 [[Y]], [[Z:%.*]] ; CHECK-NEXT: [[AND:%.*]] = select i1 [[C_1]], i1 [[C_2]], i1 false ; CHECK-NEXT: br i1 [[AND]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[X]], [[Z]] -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i32 [[X]], [[Y]] -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i32 [[Y]], [[Z]] -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[X]], [[A:%.*]] -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: [[T_1:%.*]] = icmp ule i4 [[X]], [[Z]] +; CHECK-NEXT: [[T_2:%.*]] = icmp ule i4 [[X]], [[Y]] +; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, true +; CHECK-NEXT: [[T_3:%.*]] = icmp ule i4 [[Y]], [[Z]] +; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], true +; CHECK-NEXT: [[C_3:%.*]] = icmp ule i4 [[X]], [[A:%.*]] +; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_3]] +; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: exit: -; CHECK-NEXT: [[C_4:%.*]] = icmp ule i32 [[X]], [[Z]] -; CHECK-NEXT: call void @use(i1 [[C_4]]) -; CHECK-NEXT: [[C_5:%.*]] = icmp ule i32 [[X]], [[A]] -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp ule i32 [[X]], [[Y]] -; CHECK-NEXT: call void @use(i1 [[C_6]]) -; CHECK-NEXT: [[C_7:%.*]] = icmp ule i32 [[Y]], [[Z]] -; CHECK-NEXT: call void @use(i1 [[C_7]]) -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: [[C_4:%.*]] = icmp ule i4 [[X]], [[Z]] +; CHECK-NEXT: [[C_5:%.*]] = icmp ule i4 [[X]], [[A]] +; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[C_4]], [[C_5]] +; CHECK-NEXT: [[C_6:%.*]] = icmp ule i4 [[X]], [[Y]] +; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_6]] +; CHECK-NEXT: [[C_7:%.*]] = icmp ule i4 [[Y]], [[Z]] +; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_7]] +; CHECK-NEXT: ret i1 [[R_6]] ; entry: - %c.1 = icmp ule i32 %x, %y - %c.2 = icmp ule i32 %y, %z + %c.1 = icmp ule i4 %x, %y + %c.2 = icmp ule i4 %y, %z %and = select i1 %c.1, i1 %c.2, i1 false br i1 %and, label %bb1, label %exit bb1: - %t.1 = icmp ule i32 %x, %z - call void @use(i1 %t.1) - - %t.2 = icmp ule i32 %x, %y - call void @use(i1 %t.2) - - %t.3 = icmp ule i32 %y, %z - call void @use(i1 %t.3) + %t.1 = icmp ule i4 %x, %z + %t.2 = icmp ule i4 %x, %y + %r.1 = xor i1 %t.1, %t.2 + %t.3 = icmp ule i4 %y, %z + %r.2 = xor i1 %r.1, %t.3 - %c.3 = icmp ule i32 %x, %a - call void @use(i1 %c.3) - - ret i32 10 + %c.3 = icmp ule i4 %x, %a + %r.3 = xor i1 %r.2, %c.3 + ret i1 %r.3 exit: - %c.4 = icmp ule i32 %x, %z - call void @use(i1 %c.4) - - %c.5 = icmp ule i32 %x, %a - call void @use(i1 %c.5) - - %c.6 = icmp ule i32 %x, %y - call void @use(i1 %c.6) + %c.4 = icmp ule i4 %x, %z + %c.5 = icmp ule i4 %x, %a + %r.4 = xor i1 %c.4, %c.5 - %c.7 = icmp ule i32 %y, %z - call void @use(i1 %c.7) + %c.6 = icmp ule i4 %x, %y + %r.5 = xor i1 %r.4, %c.6 - ret i32 20 + %c.7 = icmp ule i4 %y, %z + %r.6 = xor i1 %r.5, %c.7 + ret i1 %r.6 } -define i4 @and_compare_undef(i16 %N, i16 %step) { +define i4 @and_compare_undef(i4 %N, i4 %step) { ; CHECK-LABEL: @and_compare_undef( ; CHECK-NEXT: step.check: -; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i16 [[STEP:%.*]], 0 -; CHECK-NEXT: [[B1:%.*]] = add i16 undef, -1 -; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[B1]], [[N:%.*]] +; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i4 [[STEP:%.*]], 0 +; CHECK-NEXT: [[B1:%.*]] = add i4 undef, -1 +; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i4 [[B1]], [[N:%.*]] ; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 [[STEP_POS]], [[STEP_ULT_N]] ; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]] ; CHECK: ptr.check: @@ -150,9 +135,9 @@ define i4 @and_compare_undef(i16 %N, i16 %step) { ; CHECK-NEXT: ret i4 3 ; step.check: - %step.pos = icmp uge i16 %step, 0 - %B1 = add i16 undef, -1 - %step.ult.N = icmp ult i16 %B1, %N + %step.pos = icmp uge i4 %step, 0 + %B1 = add i4 undef, -1 + %step.ult.N = icmp ult i4 %B1, %N %and.step = and i1 %step.pos, %step.ult.N br i1 %and.step, label %ptr.check, label %exit diff --git a/llvm/test/Transforms/ConstraintElimination/decompose-with-temporary-indices.ll b/llvm/test/Transforms/ConstraintElimination/decompose-with-temporary-indices.ll index 79a5afa..5a00998 100644 --- a/llvm/test/Transforms/ConstraintElimination/decompose-with-temporary-indices.ll +++ b/llvm/test/Transforms/ConstraintElimination/decompose-with-temporary-indices.ll @@ -4,7 +4,7 @@ declare void @use(i1) -define void @test_uge_temporary_indices_decompose(i8 %start, i8 %n, i8 %idx) { +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:%.*]] @@ -14,24 +14,22 @@ define void @test_uge_temporary_indices_decompose(i8 %start, i8 %n, i8 %idx) { ; 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: call void @use(i1 true) ; CHECK-NEXT: [[F_0:%.*]] = icmp uge i8 [[START_ADD_IDX]], [[START_ADD_N]] -; CHECK-NEXT: call void @use(i1 false) +; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, false ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[START_ADD_1]], [[START_ADD_N]] -; CHECK-NEXT: call void @use(i1 [[C_1]]) +; 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: call void @use(i1 [[C_2]]) -; CHECK-NEXT: ret void +; 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: call void @use(i1 false) ; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[START_ADD_IDX]], [[START_ADD_N]] -; CHECK-NEXT: call void @use(i1 true) +; CHECK-NEXT: [[R_4:%.*]] = xor i1 false, true ; CHECK-NEXT: [[C_3:%.*]] = icmp ult i8 [[START_ADD_1]], [[START_ADD_N]] -; CHECK-NEXT: call void @use(i1 [[C_3]]) +; 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: call void @use(i1 [[C_4]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_4]] +; CHECK-NEXT: ret i1 [[R_6]] ; entry: %cmp.pre = icmp ult i8 %idx, %n @@ -42,32 +40,27 @@ entry: if.then: ; preds = %entry %t.0 = icmp ult i8 %start.add.idx, %start.add.n - call void @use(i1 %t.0) - %f.0 = icmp uge i8 %start.add.idx, %start.add.n - call void @use(i1 %f.0) + %r.1 = xor i1 %t.0, %f.0 %c.1 = icmp ult i8 %start.add.1, %start.add.n - call void @use(i1 %c.1) + %r.2 = xor i1 %r.1, %c.1 %c.2 = icmp ult i8 %start.add.idx, %start.add.1 - call void @use(i1 %c.2) - - ret void + %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 - call void @use(i1 %f.1) - %t.1 = icmp uge i8 %start.add.idx, %start.add.n - call void @use(i1 %t.1) + %r.4 = xor i1 %f.1, %t.1 %c.3 = icmp ult i8 %start.add.1, %start.add.n - call void @use(i1 %c.3) + %r.5 = xor i1 %r.4, %c.3 %c.4 = icmp ult i8 %start.add.idx, %start.add.1 - call void @use(i1 %c.4) + %r.6 = xor i1 %r.5, %c.4 - ret void + ret i1 %r.6 } diff --git a/llvm/test/Transforms/ConstraintElimination/dom.ll b/llvm/test/Transforms/ConstraintElimination/dom.ll index 1c3e120..39d6e1d 100644 --- a/llvm/test/Transforms/ConstraintElimination/dom.ll +++ b/llvm/test/Transforms/ConstraintElimination/dom.ll @@ -7,562 +7,527 @@ declare void @use(i1) -define i32 @test1(i32 %x) { +define i1 @test1(i8 %x) { ; CHECK-LABEL: @test1( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], 10 +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 10 +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: br label [[BB2]] ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i8 [[X]], 10 +; CHECK-NEXT: ret i1 [[C_3]] ; entry: - %c.1 = icmp ule i32 %x, 10 + %c.1 = icmp ule i8 %x, 10 br i1 %c.1, label %bb1, label %bb2 bb1: - %c.2 = icmp ule i32 %x, 10 + %c.2 = icmp ule i8 %x, 10 call void @use(i1 %c.2) br label %bb2 bb2: - %c.3 = icmp ugt i32 %x, 10 - call void @use(i1 %c.3) - ret i32 20 + %c.3 = icmp ugt i8 %x, 10 + ret i1 %c.3 } -define i32 @test2(i32 %x) { +define i1 @test2(i8 %x) { ; CHECK-LABEL: @test2( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], 10 +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB2:%.*]], label [[BB1:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[X]], 10 +; CHECK-NEXT: ret i1 [[C_2]] ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[X]], 10 +; CHECK-NEXT: [[C_3:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: br label [[BB1]] ; entry: - %c.1 = icmp ule i32 %x, 10 + %c.1 = icmp ule i8 %x, 10 br i1 %c.1, label %bb2, label %bb1 bb1: - %c.2 = icmp ugt i32 %x, 10 - call void @use(i1 %c.2) - ret i32 20 + %c.2 = icmp ugt i8 %x, 10 + ret i1 %c.2 bb2: - %c.3 = icmp ule i32 %x, 10 + %c.3 = icmp ule i8 %x, 10 call void @use(i1 %c.3) br label %bb1 } ; Test cases where the true/false successors are not domianted by the conditional branching block. -define i32 @test3(i32 %x, i1 %c) { +define i1 @test3(i8 %x, i1 %c) { ; CHECK-LABEL: @test3( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[C:%.*]], label [[BB_COND:%.*]], label [[BB1:%.*]] ; CHECK: bb.cond: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], 10 +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 10 +; CHECK-NEXT: ret i1 [[C_2]] ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i8 [[X]], 10 +; CHECK-NEXT: ret i1 true ; entry: br i1 %c, label %bb.cond, label %bb1 bb.cond: - %c.1 = icmp ule i32 %x, 10 + %c.1 = icmp ule i8 %x, 10 br i1 %c.1, label %bb1, label %bb2 bb1: - %c.2 = icmp ule i32 %x, 10 - call void @use(i1 %c.2) - ret i32 10 + %c.2 = icmp ule i8 %x, 10 + ret i1 %c.2 bb2: - %c.3 = icmp ugt i32 %x, 10 - call void @use(i1 %c.3) - ret i32 20 + %c.3 = icmp ugt i8 %x, 10 + ret i1 %c.3 } -define i32 @test4(i32 %x, i1 %c) { +define i1 @test4(i8 %x, i1 %c) { ; CHECK-LABEL: @test4( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[C:%.*]], label [[BB_COND:%.*]], label [[BB2:%.*]] ; CHECK: bb.cond: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], 10 +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 10 +; CHECK-NEXT: ret i1 true ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i8 [[X]], 10 +; CHECK-NEXT: ret i1 [[C_3]] ; entry: br i1 %c, label %bb.cond, label %bb2 bb.cond: - %c.1 = icmp ule i32 %x, 10 + %c.1 = icmp ule i8 %x, 10 br i1 %c.1, label %bb1, label %bb2 bb1: - %c.2 = icmp ule i32 %x, 10 - call void @use(i1 %c.2) - ret i32 10 + %c.2 = icmp ule i8 %x, 10 + ret i1 %c.2 bb2: - %c.3 = icmp ugt i32 %x, 10 - call void @use(i1 %c.3) - ret i32 20 + %c.3 = icmp ugt i8 %x, 10 + ret i1 %c.3 } -define void @test_cond_from_preheader(i32 %x, i1 %c) { +define i1 @test_cond_from_preheader(i8 %x, i1 %c) { ; CHECK-LABEL: @test_cond_from_preheader( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[C:%.*]], label [[PRE:%.*]], label [[BB2:%.*]] ; CHECK: pre: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], 10 +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[LOOP:%.*]], label [[BB2]] ; CHECK: loop: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[X]], 10 +; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i32 [[X]], 10 +; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 9 +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i32 [[X]], 9 +; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i8 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_3]]) ; CHECK-NEXT: br i1 true, label [[EXIT:%.*]], label [[LOOP]] ; CHECK: exit: -; CHECK-NEXT: [[C_4:%.*]] = icmp ule i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[C_4:%.*]] = icmp ule i8 [[X]], 10 +; CHECK-NEXT: ret i1 true ; CHECK: bb2: -; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[X]], 10 +; CHECK-NEXT: ret i1 [[C_5]] ; entry: br i1 %c, label %pre, label %bb2 pre: - %c.1 = icmp ule i32 %x, 10 + %c.1 = icmp ule i8 %x, 10 br i1 %c.1, label %loop, label %bb2 loop: - %t.1 = icmp ule i32 %x, 10 + %t.1 = icmp ule i8 %x, 10 call void @use(i1 %t.1) - %f.1 = icmp ugt i32 %x, 10 + %f.1 = icmp ugt i8 %x, 10 call void @use(i1 %f.1) - %c.2 = icmp ule i32 %x, 9 + %c.2 = icmp ule i8 %x, 9 call void @use(i1 %c.2) - %c.3 = icmp ugt i32 %x, 9 + %c.3 = icmp ugt i8 %x, 9 call void @use(i1 %c.3) br i1 true, label %exit, label %loop exit: - %c.4 = icmp ule i32 %x, 10 - call void @use(i1 %c.4) - ret void + %c.4 = icmp ule i8 %x, 10 + ret i1 %c.4 bb2: - %c.5 = icmp ugt i32 %x, 10 - call void @use(i1 %c.5) - ret void + %c.5 = icmp ugt i8 %x, 10 + ret i1 %c.5 } -define void @test_cond_from_preheader_successors_flipped(i32 %x, i1 %c) { +define i1 @test_cond_from_preheader_successors_flipped(i8 %x, i1 %c) { ; CHECK-LABEL: @test_cond_from_preheader_successors_flipped( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[C:%.*]], label [[PRE:%.*]], label [[BB2:%.*]] ; CHECK: pre: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], 10 +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB2]], label [[LOOP:%.*]] ; CHECK: loop: -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i32 [[X]], 10 +; CHECK-NEXT: [[F_1:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i32 [[X]], 10 +; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 11 +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 11 ; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i32 [[X]], 11 +; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i8 [[X]], 11 ; CHECK-NEXT: call void @use(i1 [[C_3]]) ; CHECK-NEXT: br i1 true, label [[EXIT:%.*]], label [[LOOP]] ; CHECK: exit: -; CHECK-NEXT: [[F_2:%.*]] = icmp ule i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[F_2:%.*]] = icmp ule i8 [[X]], 10 +; CHECK-NEXT: ret i1 false ; CHECK: bb2: -; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[X]], 10 +; CHECK-NEXT: ret i1 [[C_5]] ; entry: br i1 %c, label %pre, label %bb2 pre: - %c.1 = icmp ule i32 %x, 10 + %c.1 = icmp ule i8 %x, 10 br i1 %c.1, label %bb2, label %loop loop: - %f.1 = icmp ule i32 %x, 10 + %f.1 = icmp ule i8 %x, 10 call void @use(i1 %f.1) - %t.1 = icmp ugt i32 %x, 10 + %t.1 = icmp ugt i8 %x, 10 call void @use(i1 %t.1) - %c.2 = icmp ule i32 %x, 11 + %c.2 = icmp ule i8 %x, 11 call void @use(i1 %c.2) - %c.3 = icmp ugt i32 %x, 11 + %c.3 = icmp ugt i8 %x, 11 call void @use(i1 %c.3) br i1 true, label %exit, label %loop exit: - %f.2 = icmp ule i32 %x, 10 - call void @use(i1 %f.2) - ret void + %f.2 = icmp ule i8 %x, 10 + ret i1 %f.2 bb2: - %c.5 = icmp ugt i32 %x, 10 - call void @use(i1 %c.5) - ret void + %c.5 = icmp ugt i8 %x, 10 + ret i1 %c.5 } -define void @test_cond_from_preheader_and(i32 %x, i32 %y, i1 %c) { +define i1 @test_cond_from_preheader_and(i8 %x, i8 %y, i1 %c) { ; CHECK-LABEL: @test_cond_from_preheader_and( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[C:%.*]], label [[PRE:%.*]], label [[EXIT:%.*]] ; CHECK: exit: -; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i32 [[Y:%.*]], 10 -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[Y:%.*]], 10 +; CHECK-NEXT: ret i1 [[C_5]] ; CHECK: pre: -; CHECK-NEXT: [[X_1:%.*]] = icmp ule i32 [[X:%.*]], 10 -; CHECK-NEXT: [[Y_1:%.*]] = icmp ugt i32 [[Y]], 99 +; CHECK-NEXT: [[X_1:%.*]] = icmp ule i8 [[X:%.*]], 10 +; CHECK-NEXT: [[Y_1:%.*]] = icmp ugt i8 [[Y]], 99 ; CHECK-NEXT: [[AND:%.*]] = and i1 [[X_1]], [[Y_1]] ; CHECK-NEXT: br i1 [[AND]], label [[LOOP:%.*]], label [[EXIT_1:%.*]] ; CHECK: loop: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X]], 9 -; CHECK-NEXT: call void @use(i1 [[C_1]]) -; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i32 [[X]], 9 -; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i32 [[Y]], 99 -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_2:%.*]] = icmp ule i32 [[Y]], 99 -; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i32 [[Y]], 100 -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp ugt i32 [[Y]], 100 -; CHECK-NEXT: call void @use(i1 [[C_4]]) +; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[X]], 10 +; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i8 [[X]], 10 +; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, false +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X]], 9 +; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_1]] +; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[X]], 9 +; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_2]] +; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i8 [[Y]], 99 +; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[R_3]], true +; CHECK-NEXT: [[F_2:%.*]] = icmp ule i8 [[Y]], 99 +; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], false +; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i8 [[Y]], 100 +; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_3]] +; CHECK-NEXT: [[C_4:%.*]] = icmp ugt i8 [[Y]], 100 +; CHECK-NEXT: [[R_7:%.*]] = xor i1 [[R_6]], [[C_4]] +; CHECK-NEXT: call void @use(i1 [[R_7]]) ; CHECK-NEXT: br i1 true, label [[EXIT]], label [[LOOP]] ; CHECK: exit.1: -; CHECK-NEXT: [[C_6:%.*]] = icmp ugt i32 [[Y]], 10 -; CHECK-NEXT: call void @use(i1 [[C_6]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[C_6:%.*]] = icmp ugt i8 [[Y]], 10 +; CHECK-NEXT: ret i1 [[C_6]] ; entry: br i1 %c, label %pre, label %exit exit: - %c.5 = icmp ugt i32 %y, 10 - call void @use(i1 %c.5) - ret void + %c.5 = icmp ugt i8 %y, 10 + ret i1 %c.5 pre: - %x.1 = icmp ule i32 %x, 10 - %y.1 = icmp ugt i32 %y, 99 + %x.1 = icmp ule i8 %x, 10 + %y.1 = icmp ugt i8 %y, 99 %and = and i1 %x.1, %y.1 br i1 %and, label %loop, label %exit.1 loop: - %t.1 = icmp ule i32 %x, 10 - call void @use(i1 %t.1) - %f.1 = icmp ugt i32 %x, 10 - call void @use(i1 %f.1) - %c.1 = icmp ule i32 %x, 9 - call void @use(i1 %c.1) - %c.2 = icmp ugt i32 %x, 9 - call void @use(i1 %c.2) + %t.1 = icmp ule i8 %x, 10 + %f.1 = icmp ugt i8 %x, 10 + %r.1 = xor i1 %t.1, %f.1 + %c.1 = icmp ule i8 %x, 9 + %r.2 = xor i1 %r.1, %c.1 - %t.2 = icmp ugt i32 %y, 99 - call void @use(i1 %t.2) - %f.2 = icmp ule i32 %y, 99 - call void @use(i1 %f.2) + %c.2 = icmp ugt i8 %x, 9 + %r.3 = xor i1 %r.2, %c.2 - %c.3 = icmp ugt i32 %y, 100 - call void @use(i1 %c.3) - %c.4 = icmp ugt i32 %y, 100 - call void @use(i1 %c.4) + %t.2 = icmp ugt i8 %y, 99 + %r.4 = xor i1 %r.3, %t.2 + + %f.2 = icmp ule i8 %y, 99 + %r.5 = xor i1 %r.4, %f.2 + + %c.3 = icmp ugt i8 %y, 100 + %r.6 = xor i1 %r.5, %c.3 + + %c.4 = icmp ugt i8 %y, 100 + %r.7 = xor i1 %r.6, %c.4 + call void @use(i1 %r.7) br i1 true, label %exit, label %loop exit.1: - %c.6 = icmp ugt i32 %y, 10 - call void @use(i1 %c.6) - ret void + %c.6 = icmp ugt i8 %y, 10 + ret i1 %c.6 } -define void @test_cond_from_preheader_and_successors_flipped(i32 %x, i32 %y, i1 %c) { +define i1 @test_cond_from_preheader_and_successors_flipped(i8 %x, i8 %y, i1 %c) { ; CHECK-LABEL: @test_cond_from_preheader_and_successors_flipped( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[C:%.*]], label [[PRE:%.*]], label [[EXIT:%.*]] ; CHECK: exit: -; CHECK-NEXT: [[C_9:%.*]] = icmp ugt i32 [[Y:%.*]], 10 -; CHECK-NEXT: call void @use(i1 [[C_9]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[C_9:%.*]] = icmp ugt i8 [[Y:%.*]], 10 +; CHECK-NEXT: ret i1 [[C_9]] ; CHECK: pre: -; CHECK-NEXT: [[X_1:%.*]] = icmp ule i32 [[X:%.*]], 10 -; CHECK-NEXT: [[Y_1:%.*]] = icmp ugt i32 [[Y]], 99 +; CHECK-NEXT: [[X_1:%.*]] = icmp ule i8 [[X:%.*]], 10 +; CHECK-NEXT: [[Y_1:%.*]] = icmp ugt i8 [[Y]], 99 ; CHECK-NEXT: [[AND:%.*]] = and i1 [[X_1]], [[Y_1]] ; CHECK-NEXT: br i1 [[AND]], label [[EXIT_1:%.*]], label [[LOOP:%.*]] ; CHECK: loop: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 [[C_1]]) -; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[X]], 9 -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp ugt i32 [[X]], 9 -; CHECK-NEXT: call void @use(i1 [[C_4]]) -; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i32 [[Y]], 99 -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp ule i32 [[Y]], 99 -; CHECK-NEXT: call void @use(i1 [[C_6]]) -; CHECK-NEXT: [[C_7:%.*]] = icmp ugt i32 [[Y]], 100 -; CHECK-NEXT: call void @use(i1 [[C_7]]) -; CHECK-NEXT: [[C_8:%.*]] = icmp ugt i32 [[Y]], 100 -; CHECK-NEXT: call void @use(i1 [[C_8]]) +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X]], 10 +; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[X]], 10 +; CHECK-NEXT: [[R_1:%.*]] = xor i1 [[C_1]], [[C_2]] +; CHECK-NEXT: [[C_3:%.*]] = icmp ule i8 [[X]], 9 +; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_3]] +; CHECK-NEXT: [[C_4:%.*]] = icmp ugt i8 [[X]], 9 +; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_4]] +; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[Y]], 99 +; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[R_3]], [[C_5]] +; CHECK-NEXT: [[C_6:%.*]] = icmp ule i8 [[Y]], 99 +; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_6]] +; CHECK-NEXT: [[C_7:%.*]] = icmp ugt i8 [[Y]], 100 +; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_7]] +; CHECK-NEXT: [[C_8:%.*]] = icmp ugt i8 [[Y]], 100 +; CHECK-NEXT: [[R_7:%.*]] = xor i1 [[R_6]], [[C_8]] +; CHECK-NEXT: call void @use(i1 [[R_7]]) ; CHECK-NEXT: br i1 true, label [[EXIT]], label [[LOOP]] ; CHECK: exit.1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i32 [[Y]], 10 -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[Y]], 10 +; CHECK-NEXT: ret i1 true ; entry: br i1 %c, label %pre, label %exit exit: - %c.9 = icmp ugt i32 %y, 10 - call void @use(i1 %c.9) - ret void + %c.9 = icmp ugt i8 %y, 10 + ret i1 %c.9 pre: - %x.1 = icmp ule i32 %x, 10 - %y.1 = icmp ugt i32 %y, 99 + %x.1 = icmp ule i8 %x, 10 + %y.1 = icmp ugt i8 %y, 99 %and = and i1 %x.1, %y.1 br i1 %and, label %exit.1, label %loop loop: - %c.1 = icmp ule i32 %x, 10 - call void @use(i1 %c.1) - %c.2 = icmp ugt i32 %x, 10 - call void @use(i1 %c.2) - %c.3 = icmp ule i32 %x, 9 - call void @use(i1 %c.3) - %c.4 = icmp ugt i32 %x, 9 - call void @use(i1 %c.4) - - - %c.5 = icmp ugt i32 %y, 99 - call void @use(i1 %c.5) - %c.6 = icmp ule i32 %y, 99 - call void @use(i1 %c.6) - - %c.7 = icmp ugt i32 %y, 100 - call void @use(i1 %c.7) - %c.8 = icmp ugt i32 %y, 100 - call void @use(i1 %c.8) + %c.1 = icmp ule i8 %x, 10 + %c.2 = icmp ugt i8 %x, 10 + %r.1 = xor i1 %c.1, %c.2 + %c.3 = icmp ule i8 %x, 9 + %r.2 = xor i1 %r.1, %c.3 + %c.4 = icmp ugt i8 %x, 9 + %r.3 = xor i1 %r.2, %c.4 + + %c.5 = icmp ugt i8 %y, 99 + %r.4 = xor i1 %r.3, %c.5 + %c.6 = icmp ule i8 %y, 99 + %r.5 = xor i1 %r.4, %c.6 + + %c.7 = icmp ugt i8 %y, 100 + %r.6 = xor i1 %r.5, %c.7 + %c.8 = icmp ugt i8 %y, 100 + %r.7 = xor i1 %r.6, %c.8 + call void @use(i1 %r.7) br i1 true, label %exit, label %loop exit.1: - %t.1 = icmp ugt i32 %y, 10 - call void @use(i1 %t.1) - ret void + %t.1 = icmp ugt i8 %y, 10 + ret i1 %t.1 } -define void @test_cond_from_preheader_or(i32 %x, i32 %y, i1 %c) { +define i1 @test_cond_from_preheader_or(i8 %x, i8 %y, i1 %c) { ; CHECK-LABEL: @test_cond_from_preheader_or( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[C:%.*]], label [[PRE:%.*]], label [[EXIT:%.*]] ; CHECK: exit: -; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i32 [[Y:%.*]], 10 -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[Y:%.*]], 10 +; CHECK-NEXT: ret i1 [[C_5]] ; CHECK: pre: -; CHECK-NEXT: [[X_1:%.*]] = icmp ule i32 [[X:%.*]], 10 -; CHECK-NEXT: [[Y_1:%.*]] = icmp ugt i32 [[Y]], 99 +; CHECK-NEXT: [[X_1:%.*]] = icmp ule i8 [[X:%.*]], 10 +; CHECK-NEXT: [[Y_1:%.*]] = icmp ugt i8 [[Y]], 99 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[X_1]], [[Y_1]] ; CHECK-NEXT: br i1 [[OR]], label [[EXIT_1:%.*]], label [[LOOP:%.*]] ; CHECK: loop: -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i32 [[X]], 11 -; CHECK-NEXT: call void @use(i1 [[C_1]]) -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 11 -; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i32 [[Y]], 99 -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i32 [[Y]], 99 -; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[Y]], 98 -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp ule i32 [[Y]], 98 -; CHECK-NEXT: call void @use(i1 [[C_4]]) +; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[X]], 10 +; CHECK-NEXT: [[F_1:%.*]] = icmp ule i8 [[X]], 10 +; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, false +; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X]], 11 +; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_1]] +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 11 +; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_2]] +; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[Y]], 99 +; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[R_3]], true +; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i8 [[Y]], 99 +; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], false +; CHECK-NEXT: [[C_3:%.*]] = icmp ule i8 [[Y]], 98 +; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_3]] +; CHECK-NEXT: [[C_4:%.*]] = icmp ule i8 [[Y]], 98 +; CHECK-NEXT: [[R_7:%.*]] = xor i1 [[R_6]], [[C_4]] +; CHECK-NEXT: call void @use(i1 [[R_7]]) ; CHECK-NEXT: br i1 true, label [[EXIT]], label [[LOOP]] ; CHECK: exit.1: -; CHECK-NEXT: [[C_6:%.*]] = icmp ule i32 [[Y]], 100 -; CHECK-NEXT: call void @use(i1 [[C_6]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[C_6:%.*]] = icmp ule i8 [[Y]], 100 +; CHECK-NEXT: ret i1 [[C_6]] ; entry: br i1 %c, label %pre, label %exit exit: - %c.5 = icmp ugt i32 %y, 10 - call void @use(i1 %c.5) - ret void + %c.5 = icmp ugt i8 %y, 10 + ret i1 %c.5 pre: - %x.1 = icmp ule i32 %x, 10 - %y.1 = icmp ugt i32 %y, 99 + %x.1 = icmp ule i8 %x, 10 + %y.1 = icmp ugt i8 %y, 99 %or = or i1 %x.1, %y.1 br i1 %or, label %exit.1, label %loop loop: - %t.1 = icmp ugt i32 %x, 10 - call void @use(i1 %t.1) - %f.1 = icmp ule i32 %x, 10 - call void @use(i1 %f.1) - %c.1 = icmp ugt i32 %x, 11 - call void @use(i1 %c.1) - %c.2 = icmp ule i32 %x, 11 - call void @use(i1 %c.2) - - - %t.2 = icmp ule i32 %y, 99 - call void @use(i1 %t.2) - %f.2 = icmp ugt i32 %y, 99 - call void @use(i1 %f.2) - - %c.3 = icmp ule i32 %y, 98 - call void @use(i1 %c.3) - %c.4 = icmp ule i32 %y, 98 - call void @use(i1 %c.4) + %t.1 = icmp ugt i8 %x, 10 + %f.1 = icmp ule i8 %x, 10 + %r.1 = xor i1 %t.1, %f.1 + %c.1 = icmp ugt i8 %x, 11 + %r.2 = xor i1 %r.1, %c.1 + %c.2 = icmp ule i8 %x, 11 + %r.3 = xor i1 %r.2, %c.2 + + %t.2 = icmp ule i8 %y, 99 + %r.4 = xor i1 %r.3, %t.2 + %f.2 = icmp ugt i8 %y, 99 + %r.5 = xor i1 %r.4, %f.2 + + %c.3 = icmp ule i8 %y, 98 + %r.6 = xor i1 %r.5, %c.3 + %c.4 = icmp ule i8 %y, 98 + %r.7 = xor i1 %r.6, %c.4 + call void @use(i1 %r.7) br i1 true, label %exit, label %loop exit.1: - %c.6 = icmp ule i32 %y, 100 - call void @use(i1 %c.6) - ret void + %c.6 = icmp ule i8 %y, 100 + ret i1 %c.6 } -define void @test_cond_from_preheader_or_successor_flipped(i32 %x, i32 %y, i1 %c) { +define i1 @test_cond_from_preheader_or_successor_flipped(i8 %x, i8 %y, i1 %c) { ; CHECK-LABEL: @test_cond_from_preheader_or_successor_flipped( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[C:%.*]], label [[PRE:%.*]], label [[EXIT:%.*]] ; CHECK: exit: -; CHECK-NEXT: [[C_9:%.*]] = icmp ugt i32 [[Y:%.*]], 10 -; CHECK-NEXT: call void @use(i1 [[C_9]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[C_9:%.*]] = icmp ugt i8 [[Y:%.*]], 10 +; CHECK-NEXT: ret i1 [[C_9]] ; CHECK: pre: -; CHECK-NEXT: [[X_1:%.*]] = icmp ule i32 [[X:%.*]], 10 -; CHECK-NEXT: [[Y_1:%.*]] = icmp ugt i32 [[Y]], 99 +; CHECK-NEXT: [[X_1:%.*]] = icmp ule i8 [[X:%.*]], 10 +; CHECK-NEXT: [[Y_1:%.*]] = icmp ugt i8 [[Y]], 99 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[X_1]], [[Y_1]] ; CHECK-NEXT: br i1 [[OR]], label [[LOOP:%.*]], label [[EXIT_1:%.*]] ; CHECK: loop: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 [[C_1]]) -; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i32 [[X]], 10 -; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[X]], 9 -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp ugt i32 [[X]], 9 -; CHECK-NEXT: call void @use(i1 [[C_4]]) -; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i32 [[Y]], 99 -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp ule i32 [[Y]], 99 -; CHECK-NEXT: call void @use(i1 [[C_6]]) -; CHECK-NEXT: [[C_7:%.*]] = icmp ugt i32 [[Y]], 100 -; CHECK-NEXT: call void @use(i1 [[C_7]]) -; CHECK-NEXT: [[C_8:%.*]] = icmp ugt i32 [[Y]], 100 -; CHECK-NEXT: call void @use(i1 [[C_8]]) +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X]], 10 +; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[X]], 10 +; CHECK-NEXT: [[R_1:%.*]] = xor i1 [[C_1]], [[C_2]] +; CHECK-NEXT: [[C_3:%.*]] = icmp ule i8 [[X]], 9 +; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_3]] +; CHECK-NEXT: [[C_4:%.*]] = icmp ugt i8 [[X]], 9 +; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_4]] +; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[Y]], 99 +; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[R_3]], [[C_5]] +; CHECK-NEXT: [[C_6:%.*]] = icmp ule i8 [[Y]], 99 +; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_6]] +; CHECK-NEXT: [[C_7:%.*]] = icmp ugt i8 [[Y]], 100 +; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_7]] +; CHECK-NEXT: [[C_8:%.*]] = icmp ugt i8 [[Y]], 100 +; CHECK-NEXT: [[R_7:%.*]] = xor i1 [[R_6]], [[C_8]] +; CHECK-NEXT: call void @use(i1 [[R_7]]) ; CHECK-NEXT: br i1 true, label [[EXIT]], label [[LOOP]] ; CHECK: exit.1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[Y]], 100 -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[Y]], 100 +; CHECK-NEXT: ret i1 true ; entry: br i1 %c, label %pre, label %exit exit: - %c.9 = icmp ugt i32 %y, 10 - call void @use(i1 %c.9) - ret void + %c.9 = icmp ugt i8 %y, 10 + ret i1 %c.9 pre: - %x.1 = icmp ule i32 %x, 10 - %y.1 = icmp ugt i32 %y, 99 + %x.1 = icmp ule i8 %x, 10 + %y.1 = icmp ugt i8 %y, 99 %or = or i1 %x.1, %y.1 br i1 %or, label %loop, label %exit.1 loop: - %c.1 = icmp ule i32 %x, 10 - call void @use(i1 %c.1) - %c.2 = icmp ugt i32 %x, 10 - call void @use(i1 %c.2) - %c.3 = icmp ule i32 %x, 9 - call void @use(i1 %c.3) - %c.4 = icmp ugt i32 %x, 9 - call void @use(i1 %c.4) - - %c.5 = icmp ugt i32 %y, 99 - call void @use(i1 %c.5) - %c.6 = icmp ule i32 %y, 99 - call void @use(i1 %c.6) - - %c.7 = icmp ugt i32 %y, 100 - call void @use(i1 %c.7) - %c.8 = icmp ugt i32 %y, 100 - call void @use(i1 %c.8) + %c.1 = icmp ule i8 %x, 10 + %c.2 = icmp ugt i8 %x, 10 + %r.1 = xor i1 %c.1, %c.2 + %c.3 = icmp ule i8 %x, 9 + %r.2 = xor i1 %r.1, %c.3 + %c.4 = icmp ugt i8 %x, 9 + %r.3 = xor i1 %r.2, %c.4 + + %c.5 = icmp ugt i8 %y, 99 + %r.4 = xor i1 %r.3, %c.5 + %c.6 = icmp ule i8 %y, 99 + %r.5 = xor i1 %r.4, %c.6 + + %c.7 = icmp ugt i8 %y, 100 + %r.6 = xor i1 %r.5, %c.7 + %c.8 = icmp ugt i8 %y, 100 + %r.7 = xor i1 %r.6, %c.8 + call void @use(i1 %r.7) br i1 true, label %exit, label %loop exit.1: - %t.1 = icmp ule i32 %y, 100 - call void @use(i1 %t.1) - ret void + %t.1 = icmp ule i8 %y, 100 + ret i1 %t.1 } diff --git a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll index 220c8fa..b183e88 100644 --- a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll +++ b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll @@ -362,10 +362,10 @@ exit: ret i4 3 } -define i4 @ptr_N_could_be_negative(i8* %src, i8* %lower, i8* %upper, i16 %N, i16 %step) { +define i4 @ptr_N_could_be_negative(i8* %src, i8* %lower, i8* %upper, i8 %N, i8 %step) { ; CHECK-LABEL: @ptr_N_could_be_negative( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[SRC_END:%.*]] = getelementptr inbounds i8, i8* [[SRC:%.*]], i16 [[N:%.*]] +; CHECK-NEXT: [[SRC_END:%.*]] = getelementptr inbounds i8, i8* [[SRC:%.*]], i8 [[N:%.*]] ; CHECK-NEXT: [[CMP_SRC_START:%.*]] = icmp ult i8* [[SRC]], [[LOWER:%.*]] ; CHECK-NEXT: [[CMP_SRC_END:%.*]] = icmp uge i8* [[SRC_END]], [[UPPER:%.*]] ; CHECK-NEXT: [[OR_PRECOND_0:%.*]] = or i1 [[CMP_SRC_START]], [[CMP_SRC_END]] @@ -373,12 +373,12 @@ define i4 @ptr_N_could_be_negative(i8* %src, i8* %lower, i8* %upper, i16 %N, i16 ; CHECK: trap.bb: ; CHECK-NEXT: ret i4 2 ; CHECK: step.check: -; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i16 [[STEP:%.*]], 0 -; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[STEP]], [[N]] +; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i8 [[STEP:%.*]], 0 +; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i8 [[STEP]], [[N]] ; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 [[STEP_POS]], [[STEP_ULT_N]] ; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]] ; CHECK: ptr.check: -; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, i8* [[SRC]], i16 [[STEP]] +; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, i8* [[SRC]], i8 [[STEP]] ; CHECK-NEXT: [[CMP_STEP_START:%.*]] = icmp ult i8* [[SRC_STEP]], [[LOWER]] ; CHECK-NEXT: [[CMP_STEP_END:%.*]] = icmp uge i8* [[SRC_STEP]], [[UPPER]] ; CHECK-NEXT: [[OR_CHECK:%.*]] = or i1 false, false @@ -387,7 +387,7 @@ define i4 @ptr_N_could_be_negative(i8* %src, i8* %lower, i8* %upper, i16 %N, i16 ; CHECK-NEXT: ret i4 3 ; entry: - %src.end = getelementptr inbounds i8, i8* %src, i16 %N + %src.end = getelementptr inbounds i8, i8* %src, i8 %N %cmp.src.start = icmp ult i8* %src, %lower %cmp.src.end = icmp uge i8* %src.end, %upper %or.precond.0 = or i1 %cmp.src.start, %cmp.src.end @@ -397,13 +397,13 @@ trap.bb: ret i4 2 step.check: - %step.pos = icmp uge i16 %step, 0 - %step.ult.N = icmp ult i16 %step, %N + %step.pos = icmp uge i8 %step, 0 + %step.ult.N = icmp ult i8 %step, %N %and.step = and i1 %step.pos, %step.ult.N br i1 %and.step, label %ptr.check, label %exit ptr.check: - %src.step = getelementptr inbounds i8, i8* %src, i16 %step + %src.step = getelementptr inbounds i8, i8* %src, i8 %step %cmp.step.start = icmp ult i8* %src.step, %lower %cmp.step.end = icmp uge i8* %src.step, %upper %or.check = or i1 %cmp.step.start, %cmp.step.end @@ -413,10 +413,10 @@ exit: ret i4 3 } -define i4 @ptr_src_uge_end(i8* %src, i8* %lower, i8* %upper, i16 %N, i16 %step) { +define i4 @ptr_src_uge_end(i8* %src, i8* %lower, i8* %upper, i8 %N, i8 %step) { ; CHECK-LABEL: @ptr_src_uge_end( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[SRC_END:%.*]] = getelementptr inbounds i8, i8* [[SRC:%.*]], i16 [[N:%.*]] +; CHECK-NEXT: [[SRC_END:%.*]] = getelementptr inbounds i8, i8* [[SRC:%.*]], i8 [[N:%.*]] ; CHECK-NEXT: [[CMP_SRC_START:%.*]] = icmp ult i8* [[SRC]], [[LOWER:%.*]] ; CHECK-NEXT: [[CMP_SRC_END:%.*]] = icmp uge i8* [[SRC_END]], [[UPPER:%.*]] ; CHECK-NEXT: [[CMP_OVERFLOW:%.*]] = icmp ugt i8* [[SRC]], [[SRC_END]] @@ -426,12 +426,12 @@ define i4 @ptr_src_uge_end(i8* %src, i8* %lower, i8* %upper, i16 %N, i16 %step) ; CHECK: trap.bb: ; CHECK-NEXT: ret i4 2 ; CHECK: step.check: -; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i16 [[STEP:%.*]], 0 -; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[STEP]], [[N]] +; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i8 [[STEP:%.*]], 0 +; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i8 [[STEP]], [[N]] ; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 [[STEP_POS]], [[STEP_ULT_N]] ; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]] ; CHECK: ptr.check: -; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, i8* [[SRC]], i16 [[STEP]] +; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, i8* [[SRC]], i8 [[STEP]] ; CHECK-NEXT: [[CMP_STEP_START:%.*]] = icmp ult i8* [[SRC_STEP]], [[LOWER]] ; CHECK-NEXT: [[CMP_STEP_END:%.*]] = icmp uge i8* [[SRC_STEP]], [[UPPER]] ; CHECK-NEXT: [[OR_CHECK:%.*]] = or i1 [[CMP_STEP_START]], [[CMP_STEP_END]] @@ -440,7 +440,7 @@ define i4 @ptr_src_uge_end(i8* %src, i8* %lower, i8* %upper, i16 %N, i16 %step) ; CHECK-NEXT: ret i4 3 ; entry: - %src.end = getelementptr inbounds i8, i8* %src, i16 %N + %src.end = getelementptr inbounds i8, i8* %src, i8 %N %cmp.src.start = icmp ult i8* %src, %lower %cmp.src.end = icmp uge i8* %src.end, %upper %cmp.overflow = icmp ugt i8* %src, %src.end @@ -452,13 +452,13 @@ trap.bb: ret i4 2 step.check: - %step.pos = icmp uge i16 %step, 0 - %step.ult.N = icmp ult i16 %step, %N + %step.pos = icmp uge i8 %step, 0 + %step.ult.N = icmp ult i8 %step, %N %and.step = and i1 %step.pos, %step.ult.N br i1 %and.step, label %ptr.check, label %exit ptr.check: - %src.step = getelementptr inbounds i8, i8* %src, i16 %step + %src.step = getelementptr inbounds i8, i8* %src, i8 %step %cmp.step.start = icmp ult i8* %src.step, %lower %cmp.step.end = icmp uge i8* %src.step, %upper %or.check = or i1 %cmp.step.start, %cmp.step.end @@ -468,10 +468,10 @@ exit: ret i4 3 } -define i4 @inc_ptr_N_could_be_negative(i8* %src, i8* %lower, i8* %upper, i16 %N, i16 %step) { +define i4 @inc_ptr_N_could_be_negative(i8* %src, i8* %lower, i8* %upper, i8 %N, i8 %step) { ; CHECK-LABEL: @inc_ptr_N_could_be_negative( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[SRC_END:%.*]] = getelementptr inbounds i8, i8* [[SRC:%.*]], i16 [[N:%.*]] +; CHECK-NEXT: [[SRC_END:%.*]] = getelementptr inbounds i8, i8* [[SRC:%.*]], i8 [[N:%.*]] ; CHECK-NEXT: [[CMP_SRC_START:%.*]] = icmp ult i8* [[SRC]], [[LOWER:%.*]] ; CHECK-NEXT: [[CMP_SRC_END:%.*]] = icmp uge i8* [[SRC_END]], [[UPPER:%.*]] ; CHECK-NEXT: [[OR_PRECOND_0:%.*]] = or i1 [[CMP_SRC_START]], [[CMP_SRC_END]] @@ -479,13 +479,13 @@ define i4 @inc_ptr_N_could_be_negative(i8* %src, i8* %lower, i8* %upper, i16 %N, ; CHECK: trap.bb: ; CHECK-NEXT: ret i4 2 ; CHECK: step.check: -; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i16 [[STEP:%.*]], 0 -; CHECK-NEXT: [[NEXT:%.*]] = add nuw nsw i16 [[STEP]], 2 -; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[NEXT]], [[N]] +; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i8 [[STEP:%.*]], 0 +; CHECK-NEXT: [[NEXT:%.*]] = add nuw nsw i8 [[STEP]], 2 +; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i8 [[NEXT]], [[N]] ; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 [[STEP_POS]], [[STEP_ULT_N]] ; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]] ; CHECK: ptr.check: -; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, i8* [[SRC]], i16 [[STEP]] +; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, i8* [[SRC]], i8 [[STEP]] ; CHECK-NEXT: [[CMP_STEP_START:%.*]] = icmp ult i8* [[SRC_STEP]], [[LOWER]] ; CHECK-NEXT: [[CMP_STEP_END:%.*]] = icmp uge i8* [[SRC_STEP]], [[UPPER]] ; CHECK-NEXT: [[OR_CHECK:%.*]] = or i1 false, false @@ -494,7 +494,7 @@ define i4 @inc_ptr_N_could_be_negative(i8* %src, i8* %lower, i8* %upper, i16 %N, ; CHECK-NEXT: ret i4 3 ; entry: - %src.end = getelementptr inbounds i8, i8* %src, i16 %N + %src.end = getelementptr inbounds i8, i8* %src, i8 %N %cmp.src.start = icmp ult i8* %src, %lower %cmp.src.end = icmp uge i8* %src.end, %upper %or.precond.0 = or i1 %cmp.src.start, %cmp.src.end @@ -504,14 +504,14 @@ trap.bb: ret i4 2 step.check: - %step.pos = icmp uge i16 %step, 0 - %next = add nsw nuw i16 %step, 2 - %step.ult.N = icmp ult i16 %next, %N + %step.pos = icmp uge i8 %step, 0 + %next = add nsw nuw i8 %step, 2 + %step.ult.N = icmp ult i8 %next, %N %and.step = and i1 %step.pos, %step.ult.N br i1 %and.step, label %ptr.check, label %exit ptr.check: - %src.step = getelementptr inbounds i8, i8* %src, i16 %step + %src.step = getelementptr inbounds i8, i8* %src, i8 %step %cmp.step.start = icmp ult i8* %src.step, %lower %cmp.step.end = icmp uge i8* %src.step, %upper %or.check = or i1 %cmp.step.start, %cmp.step.end diff --git a/llvm/test/Transforms/ConstraintElimination/geps.ll b/llvm/test/Transforms/ConstraintElimination/geps.ll index 9141ace..90f4ab5 100644 --- a/llvm/test/Transforms/ConstraintElimination/geps.ll +++ b/llvm/test/Transforms/ConstraintElimination/geps.ll @@ -471,14 +471,14 @@ if.end: ; preds = %entry ret void } -define void @test.not.uge.uge.nonconst(i8* %start, i8* %low, i8* %high, i64 %off) { +define void @test.not.uge.uge.nonconst(i8* %start, i8* %low, i8* %high, i8 %off) { ; CHECK-LABEL: @test.not.uge.uge.nonconst( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds i8, i8* [[START:%.*]], i64 [[OFF:%.*]] +; CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds i8, i8* [[START:%.*]], i8 [[OFF:%.*]] ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8* [[ADD_PTR_I]], [[HIGH:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] ; CHECK: if.then: -; CHECK-NEXT: [[START_OFF_2:%.*]] = getelementptr inbounds i8, i8* [[START]], i64 [[OFF]] +; CHECK-NEXT: [[START_OFF_2:%.*]] = getelementptr inbounds i8, i8* [[START]], i8 [[OFF]] ; CHECK-NEXT: [[T_0:%.*]] = icmp uge i8* [[START_OFF_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void @@ -486,18 +486,18 @@ define void @test.not.uge.uge.nonconst(i8* %start, i8* %low, i8* %high, i64 %off ; CHECK-NEXT: [[START_1:%.*]] = getelementptr inbounds i8, i8* [[START]], i64 1 ; CHECK-NEXT: [[C_0:%.*]] = icmp uge i8* [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 [[C_0]]) -; CHECK-NEXT: [[START_OFF:%.*]] = getelementptr inbounds i8, i8* [[START]], i64 [[OFF]] +; CHECK-NEXT: [[START_OFF:%.*]] = getelementptr inbounds i8, i8* [[START]], i8 [[OFF]] ; CHECK-NEXT: [[F_0:%.*]] = icmp uge i8* [[START_OFF]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: ret void ; entry: - %add.ptr.i = getelementptr inbounds i8, i8* %start, i64 %off + %add.ptr.i = getelementptr inbounds i8, i8* %start, i8 %off %c.1 = icmp uge i8* %add.ptr.i, %high br i1 %c.1, label %if.then, label %if.end if.then: ; preds = %entry - %start.off.2 = getelementptr inbounds i8, i8* %start, i64 %off + %start.off.2 = getelementptr inbounds i8, i8* %start, i8 %off %t.0 = icmp uge i8* %start.off.2, %high call void @use(i1 %t.0) @@ -508,7 +508,7 @@ if.end: ; preds = %entry %c.0 = icmp uge i8* %start.1, %high call void @use(i1 %c.0) - %start.off = getelementptr inbounds i8, i8* %start, i64 %off + %start.off = getelementptr inbounds i8, i8* %start, i8 %off %f.0 = icmp uge i8* %start.off, %high call void @use(i1 %f.0) @@ -516,7 +516,7 @@ if.end: ; preds = %entry } ; Test which requires decomposing GEP %ptr, SHL(). -define void @test.ult.gep.shl(i32* readonly %src, i32* readnone %max, i32 %idx) { +define void @test.ult.gep.shl(i32* readonly %src, i32* readnone %max, i8 %idx) { ; CHECK-LABEL: @test.ult.gep.shl( ; CHECK-NEXT: check.0.min: ; CHECK-NEXT: [[ADD_10:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i32 10 @@ -525,23 +525,23 @@ define void @test.ult.gep.shl(i32* readonly %src, i32* readnone %max, i32 %idx) ; CHECK: trap: ; CHECK-NEXT: ret void ; CHECK: check.idx: -; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[IDX:%.*]], 5 +; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[IDX:%.*]], 5 ; CHECK-NEXT: br i1 [[CMP]], label [[CHECK_MAX:%.*]], label [[TRAP]] ; CHECK: check.max: -; CHECK-NEXT: [[IDX_SHL_1:%.*]] = shl nuw i32 [[IDX]], 1 -; CHECK-NEXT: [[ADD_PTR_SHL_1:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i32 [[IDX_SHL_1]] +; CHECK-NEXT: [[IDX_SHL_1:%.*]] = shl nuw i8 [[IDX]], 1 +; CHECK-NEXT: [[ADD_PTR_SHL_1:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i8 [[IDX_SHL_1]] ; CHECK-NEXT: [[C_MAX_0:%.*]] = icmp ult i32* [[ADD_PTR_SHL_1]], [[MAX]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[IDX_SHL_2:%.*]] = shl nuw i32 [[IDX]], 2 -; CHECK-NEXT: [[ADD_PTR_SHL_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i32 [[IDX_SHL_2]] +; CHECK-NEXT: [[IDX_SHL_2:%.*]] = shl nuw i8 [[IDX]], 2 +; CHECK-NEXT: [[ADD_PTR_SHL_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i8 [[IDX_SHL_2]] ; CHECK-NEXT: [[C_MAX_1:%.*]] = icmp ult i32* [[ADD_PTR_SHL_2]], [[MAX]] ; CHECK-NEXT: call void @use(i1 [[C_MAX_1]]) -; CHECK-NEXT: [[IDX_SHL_NOT_NUW:%.*]] = shl i32 [[IDX]], 1 -; CHECK-NEXT: [[ADD_PTR_SHL_NOT_NUW:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i32 [[IDX_SHL_NOT_NUW]] +; CHECK-NEXT: [[IDX_SHL_NOT_NUW:%.*]] = shl i8 [[IDX]], 1 +; CHECK-NEXT: [[ADD_PTR_SHL_NOT_NUW:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i8 [[IDX_SHL_NOT_NUW]] ; CHECK-NEXT: [[C_MAX_2:%.*]] = icmp ult i32* [[ADD_PTR_SHL_NOT_NUW]], [[MAX]] ; CHECK-NEXT: call void @use(i1 [[C_MAX_2]]) -; CHECK-NEXT: [[IDX_SHL_3:%.*]] = shl nuw i32 [[IDX]], 3 -; CHECK-NEXT: [[ADD_PTR_SHL_3:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i32 [[IDX_SHL_3]] +; CHECK-NEXT: [[IDX_SHL_3:%.*]] = shl nuw i8 [[IDX]], 3 +; CHECK-NEXT: [[ADD_PTR_SHL_3:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i8 [[IDX_SHL_3]] ; CHECK-NEXT: [[C_MAX_3:%.*]] = icmp ult i32* [[ADD_PTR_SHL_3]], [[MAX]] ; CHECK-NEXT: call void @use(i1 [[C_MAX_3]]) ; CHECK-NEXT: ret void @@ -555,27 +555,27 @@ trap: ret void check.idx: ; preds = %check.0.min - %cmp = icmp ult i32 %idx, 5 + %cmp = icmp ult i8 %idx, 5 br i1 %cmp, label %check.max, label %trap check.max: ; preds = %check.0.min - %idx.shl.1 = shl nuw i32 %idx, 1 - %add.ptr.shl.1 = getelementptr inbounds i32, i32* %src, i32 %idx.shl.1 + %idx.shl.1 = shl nuw i8 %idx, 1 + %add.ptr.shl.1 = getelementptr inbounds i32, i32* %src, i8 %idx.shl.1 %c.max.0 = icmp ult i32* %add.ptr.shl.1, %max call void @use(i1 %c.max.0) - %idx.shl.2 = shl nuw i32 %idx, 2 - %add.ptr.shl.2 = getelementptr inbounds i32, i32* %src, i32 %idx.shl.2 + %idx.shl.2 = shl nuw i8 %idx, 2 + %add.ptr.shl.2 = getelementptr inbounds i32, i32* %src, i8 %idx.shl.2 %c.max.1 = icmp ult i32* %add.ptr.shl.2, %max call void @use(i1 %c.max.1) - %idx.shl.not.nuw = shl i32 %idx, 1 - %add.ptr.shl.not.nuw = getelementptr inbounds i32, i32* %src, i32 %idx.shl.not.nuw + %idx.shl.not.nuw = shl i8 %idx, 1 + %add.ptr.shl.not.nuw = getelementptr inbounds i32, i32* %src, i8 %idx.shl.not.nuw %c.max.2 = icmp ult i32* %add.ptr.shl.not.nuw, %max call void @use(i1 %c.max.2) - %idx.shl.3 = shl nuw i32 %idx, 3 - %add.ptr.shl.3 = getelementptr inbounds i32, i32* %src, i32 %idx.shl.3 + %idx.shl.3 = shl nuw i8 %idx, 3 + %add.ptr.shl.3 = getelementptr inbounds i32, i32* %src, i8 %idx.shl.3 %c.max.3 = icmp ult i32* %add.ptr.shl.3, %max call void @use(i1 %c.max.3) diff --git a/llvm/test/Transforms/ConstraintElimination/loops-bottom-tested-pointer-cmps.ll b/llvm/test/Transforms/ConstraintElimination/loops-bottom-tested-pointer-cmps.ll index 55b1b89..44d3f45 100644 --- a/llvm/test/Transforms/ConstraintElimination/loops-bottom-tested-pointer-cmps.ll +++ b/llvm/test/Transforms/ConstraintElimination/loops-bottom-tested-pointer-cmps.ll @@ -2,32 +2,32 @@ ; RUN: opt -constraint-elimination -S %s | FileCheck %s declare void @use(i1) -define void @checks_in_loops_removable(i8* %ptr, i8* %lower, i8* %upper, i32 %n) { +define void @checks_in_loops_removable(i8* %ptr, i8* %lower, i8* %upper, i8 %n) { ; CHECK-LABEL: @checks_in_loops_removable( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP_PTR_LOWER:%.*]] = icmp ult i8* [[PTR:%.*]], [[LOWER:%.*]] ; CHECK-NEXT: br i1 [[CMP_PTR_LOWER]], label [[TRAP:%.*]], label [[PRE_1:%.*]] ; CHECK: pre.1: -; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[N:%.*]] to i64 -; CHECK-NEXT: [[PTR_N:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[IDX_EXT]] +; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i8 [[N:%.*]] to i16 +; CHECK-NEXT: [[PTR_N:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i16 [[IDX_EXT]] ; CHECK-NEXT: [[CMP_PTR_N_UPPER:%.*]] = icmp ult i8* [[PTR_N]], [[UPPER:%.*]] ; CHECK-NEXT: br i1 [[CMP_PTR_N_UPPER]], label [[PRE_2:%.*]], label [[TRAP]] ; CHECK: pre.2: -; CHECK-NEXT: [[CMP_N_NOT_ZERO:%.*]] = icmp eq i32 [[N]], 0 +; CHECK-NEXT: [[CMP_N_NOT_ZERO:%.*]] = icmp eq i8 [[N]], 0 ; CHECK-NEXT: br i1 [[CMP_N_NOT_ZERO]], label [[EXIT:%.*]], label [[LOOP_HEADER:%.*]] ; CHECK: trap: ; CHECK-NEXT: ret void ; CHECK: loop.header: -; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[PRE_2]] ], [ [[IV_NEXT:%.*]], [[LOOP_LATCH:%.*]] ] -; CHECK-NEXT: [[PTR_IV:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[IV]] +; CHECK-NEXT: [[IV:%.*]] = phi i16 [ 0, [[PRE_2]] ], [ [[IV_NEXT:%.*]], [[LOOP_LATCH:%.*]] ] +; CHECK-NEXT: [[PTR_IV:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i16 [[IV]] ; CHECK-NEXT: [[CMP_PTR_IV_LOWER:%.*]] = icmp ugt i8* [[LOWER]], [[PTR_IV]] ; CHECK-NEXT: [[CMP_PTR_IV_UPPER:%.*]] = icmp ule i8* [[UPPER]], [[PTR_IV]] ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP_PTR_IV_LOWER]], [[CMP_PTR_IV_UPPER]] ; CHECK-NEXT: br i1 [[OR]], label [[TRAP]], label [[LOOP_LATCH]] ; CHECK: loop.latch: ; CHECK-NEXT: store i8 0, i8* [[PTR_IV]], align 4 -; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[IV_NEXT]], [[IDX_EXT]] +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i16 [[IV]], 1 +; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i16 [[IV_NEXT]], [[IDX_EXT]] ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP_HEADER]], label [[EXIT]] ; CHECK: exit: ; CHECK-NEXT: ret void @@ -37,21 +37,21 @@ entry: br i1 %cmp.ptr.lower, label %trap, label %pre.1 pre.1: - %idx.ext = zext i32 %n to i64 - %ptr.n = getelementptr inbounds i8, i8* %ptr, i64 %idx.ext + %idx.ext = zext i8 %n to i16 + %ptr.n = getelementptr inbounds i8, i8* %ptr, i16 %idx.ext %cmp.ptr.n.upper = icmp ult i8* %ptr.n, %upper br i1 %cmp.ptr.n.upper, label %pre.2, label %trap pre.2: - %cmp.n.not.zero = icmp eq i32 %n, 0 + %cmp.n.not.zero = icmp eq i8 %n, 0 br i1 %cmp.n.not.zero, label %exit, label %loop.header trap: ret void loop.header: - %iv = phi i64 [ 0, %pre.2 ], [ %iv.next, %loop.latch ] - %ptr.iv = getelementptr inbounds i8, i8* %ptr, i64 %iv + %iv = phi i16 [ 0, %pre.2 ], [ %iv.next, %loop.latch ] + %ptr.iv = getelementptr inbounds i8, i8* %ptr, i16 %iv %cmp.ptr.iv.lower = icmp ugt i8* %lower, %ptr.iv %cmp.ptr.iv.upper = icmp ule i8* %upper, %ptr.iv %or = or i1 %cmp.ptr.iv.lower, %cmp.ptr.iv.upper @@ -59,47 +59,47 @@ loop.header: loop.latch: store i8 0, i8* %ptr.iv, align 4 - %iv.next = add nuw nsw i64 %iv, 1 - %exitcond = icmp ne i64 %iv.next, %idx.ext + %iv.next = add nuw nsw i16 %iv, 1 + %exitcond = icmp ne i16 %iv.next, %idx.ext br i1 %exitcond, label %loop.header, label %exit exit: ret void } -define void @some_checks_in_loops_removable(i8* %ptr, i8* %lower, i8* %upper, i32 %n) { +define void @some_checks_in_loops_removable(i8* %ptr, i8* %lower, i8* %upper, i8 %n) { ; CHECK-LABEL: @some_checks_in_loops_removable( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP_PTR_LOWER:%.*]] = icmp ult i8* [[PTR:%.*]], [[LOWER:%.*]] ; CHECK-NEXT: br i1 [[CMP_PTR_LOWER]], label [[TRAP:%.*]], label [[PRE_1:%.*]] ; CHECK: pre.1: -; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[N:%.*]] to i64 -; CHECK-NEXT: [[PTR_N:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[IDX_EXT]] +; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i8 [[N:%.*]] to i16 +; CHECK-NEXT: [[PTR_N:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i16 [[IDX_EXT]] ; CHECK-NEXT: [[CMP_PTR_N_UPPER:%.*]] = icmp ult i8* [[PTR_N]], [[UPPER:%.*]] ; CHECK-NEXT: br i1 [[CMP_PTR_N_UPPER]], label [[PRE_2:%.*]], label [[TRAP]] ; CHECK: pre.2: -; CHECK-NEXT: [[CMP_N_NOT_ZERO:%.*]] = icmp eq i32 [[N]], 0 +; CHECK-NEXT: [[CMP_N_NOT_ZERO:%.*]] = icmp eq i8 [[N]], 0 ; CHECK-NEXT: br i1 [[CMP_N_NOT_ZERO]], label [[EXIT:%.*]], label [[LOOP_HEADER:%.*]] ; CHECK: trap: ; CHECK-NEXT: ret void ; CHECK: loop.header: -; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[PRE_2]] ], [ [[IV_NEXT:%.*]], [[LOOP_LATCH:%.*]] ] -; CHECK-NEXT: [[PTR_IV:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[IV]] +; CHECK-NEXT: [[IV:%.*]] = phi i16 [ 0, [[PRE_2]] ], [ [[IV_NEXT:%.*]], [[LOOP_LATCH:%.*]] ] +; CHECK-NEXT: [[PTR_IV:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i16 [[IV]] ; CHECK-NEXT: [[CMP_PTR_IV_LOWER:%.*]] = icmp ugt i8* [[LOWER]], [[PTR_IV]] ; CHECK-NEXT: [[CMP_PTR_IV_UPPER:%.*]] = icmp ule i8* [[UPPER]], [[PTR_IV]] ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP_PTR_IV_LOWER]], [[CMP_PTR_IV_UPPER]] ; CHECK-NEXT: br i1 [[OR]], label [[TRAP]], label [[LOOP_BODY:%.*]] ; CHECK: loop.body: -; CHECK-NEXT: [[IV_1:%.*]] = add nuw nsw i64 [[IV]], 1 -; CHECK-NEXT: [[PTR_IV_1:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[IV_1]] +; CHECK-NEXT: [[IV_1:%.*]] = add nuw nsw i16 [[IV]], 1 +; CHECK-NEXT: [[PTR_IV_1:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i16 [[IV_1]] ; CHECK-NEXT: [[CMP_PTR_IV_1_LOWER:%.*]] = icmp ugt i8* [[LOWER]], [[PTR_IV_1]] ; CHECK-NEXT: [[CMP_PTR_IV_1_UPPER:%.*]] = icmp ule i8* [[UPPER]], [[PTR_IV_1]] ; CHECK-NEXT: [[OR_1:%.*]] = or i1 false, [[CMP_PTR_IV_1_UPPER]] ; CHECK-NEXT: br i1 [[OR]], label [[TRAP]], label [[LOOP_LATCH]] ; CHECK: loop.latch: ; CHECK-NEXT: store i8 0, i8* [[PTR_IV]], align 4 -; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[IV_NEXT]], [[IDX_EXT]] +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i16 [[IV]], 1 +; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i16 [[IV_NEXT]], [[IDX_EXT]] ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP_HEADER]], label [[EXIT]] ; CHECK: exit: ; CHECK-NEXT: ret void @@ -109,29 +109,29 @@ entry: br i1 %cmp.ptr.lower, label %trap, label %pre.1 pre.1: - %idx.ext = zext i32 %n to i64 - %ptr.n = getelementptr inbounds i8, i8* %ptr, i64 %idx.ext + %idx.ext = zext i8 %n to i16 + %ptr.n = getelementptr inbounds i8, i8* %ptr, i16 %idx.ext %cmp.ptr.n.upper = icmp ult i8* %ptr.n, %upper br i1 %cmp.ptr.n.upper, label %pre.2, label %trap pre.2: - %cmp.n.not.zero = icmp eq i32 %n, 0 + %cmp.n.not.zero = icmp eq i8 %n, 0 br i1 %cmp.n.not.zero, label %exit, label %loop.header trap: ret void loop.header: - %iv = phi i64 [ 0, %pre.2 ], [ %iv.next, %loop.latch ] - %ptr.iv = getelementptr inbounds i8, i8* %ptr, i64 %iv + %iv = phi i16 [ 0, %pre.2 ], [ %iv.next, %loop.latch ] + %ptr.iv = getelementptr inbounds i8, i8* %ptr, i16 %iv %cmp.ptr.iv.lower = icmp ugt i8* %lower, %ptr.iv %cmp.ptr.iv.upper = icmp ule i8* %upper, %ptr.iv %or = or i1 %cmp.ptr.iv.lower, %cmp.ptr.iv.upper br i1 %or, label %trap, label %loop.body loop.body: - %iv.1 = add nuw nsw i64 %iv, 1 - %ptr.iv.1 = getelementptr inbounds i8, i8* %ptr, i64 %iv.1 + %iv.1 = add nuw nsw i16 %iv, 1 + %ptr.iv.1 = getelementptr inbounds i8, i8* %ptr, i16 %iv.1 %cmp.ptr.iv.1.lower = icmp ugt i8* %lower, %ptr.iv.1 %cmp.ptr.iv.1.upper = icmp ule i8* %upper, %ptr.iv.1 %or.1 = or i1 %cmp.ptr.iv.1.lower, %cmp.ptr.iv.1.upper @@ -139,8 +139,8 @@ loop.body: loop.latch: store i8 0, i8* %ptr.iv, align 4 - %iv.next = add nuw nsw i64 %iv, 1 - %exitcond = icmp ne i64 %iv.next, %idx.ext + %iv.next = add nuw nsw i16 %iv, 1 + %exitcond = icmp ne i16 %iv.next, %idx.ext br i1 %exitcond, label %loop.header, label %exit exit: @@ -149,36 +149,36 @@ exit: ; N might be zero, cannot remove upper checks. -define void @no_checks_in_loops_removable(i8* %ptr, i8* %lower, i8* %upper, i32 %n) { +define void @no_checks_in_loops_removable(i8* %ptr, i8* %lower, i8* %upper, i8 %n) { ; CHECK-LABEL: @no_checks_in_loops_removable( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP_PTR_LOWER:%.*]] = icmp ult i8* [[PTR:%.*]], [[LOWER:%.*]] ; CHECK-NEXT: br i1 [[CMP_PTR_LOWER]], label [[TRAP:%.*]], label [[PRE_1:%.*]] ; CHECK: pre.1: -; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[N:%.*]] to i64 -; CHECK-NEXT: [[PTR_N:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[IDX_EXT]] +; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i8 [[N:%.*]] to i16 +; CHECK-NEXT: [[PTR_N:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i16 [[IDX_EXT]] ; CHECK-NEXT: [[CMP_PTR_N_UPPER:%.*]] = icmp ult i8* [[PTR_N]], [[UPPER:%.*]] ; CHECK-NEXT: br i1 [[CMP_PTR_N_UPPER]], label [[LOOP_HEADER:%.*]], label [[TRAP]] ; CHECK: trap: ; CHECK-NEXT: ret void ; CHECK: loop.header: -; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[PRE_1]] ], [ [[IV_NEXT:%.*]], [[LOOP_LATCH:%.*]] ] -; CHECK-NEXT: [[PTR_IV:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[IV]] +; CHECK-NEXT: [[IV:%.*]] = phi i16 [ 0, [[PRE_1]] ], [ [[IV_NEXT:%.*]], [[LOOP_LATCH:%.*]] ] +; CHECK-NEXT: [[PTR_IV:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i16 [[IV]] ; CHECK-NEXT: [[CMP_PTR_IV_LOWER:%.*]] = icmp ugt i8* [[LOWER]], [[PTR_IV]] ; CHECK-NEXT: [[CMP_PTR_IV_UPPER:%.*]] = icmp ule i8* [[UPPER]], [[PTR_IV]] ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP_PTR_IV_LOWER]], [[CMP_PTR_IV_UPPER]] ; CHECK-NEXT: br i1 [[OR]], label [[TRAP]], label [[LOOP_BODY:%.*]] ; CHECK: loop.body: -; CHECK-NEXT: [[IV_1:%.*]] = add nuw nsw i64 [[IV]], 1 -; CHECK-NEXT: [[PTR_IV_1:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[IV_1]] +; CHECK-NEXT: [[IV_1:%.*]] = add nuw nsw i16 [[IV]], 1 +; CHECK-NEXT: [[PTR_IV_1:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i16 [[IV_1]] ; CHECK-NEXT: [[CMP_PTR_IV_1_LOWER:%.*]] = icmp ugt i8* [[LOWER]], [[PTR_IV_1]] ; CHECK-NEXT: [[CMP_PTR_IV_1_UPPER:%.*]] = icmp ule i8* [[UPPER]], [[PTR_IV_1]] ; CHECK-NEXT: [[OR_1:%.*]] = or i1 false, [[CMP_PTR_IV_1_UPPER]] ; CHECK-NEXT: br i1 [[OR]], label [[TRAP]], label [[LOOP_LATCH]] ; CHECK: loop.latch: ; CHECK-NEXT: store i8 0, i8* [[PTR_IV]], align 4 -; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[IV_NEXT]], [[IDX_EXT]] +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i16 [[IV]], 1 +; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i16 [[IV_NEXT]], [[IDX_EXT]] ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP_HEADER]], label [[EXIT:%.*]] ; CHECK: exit: ; CHECK-NEXT: ret void @@ -188,8 +188,8 @@ entry: br i1 %cmp.ptr.lower, label %trap, label %pre.1 pre.1: - %idx.ext = zext i32 %n to i64 - %ptr.n = getelementptr inbounds i8, i8* %ptr, i64 %idx.ext + %idx.ext = zext i8 %n to i16 + %ptr.n = getelementptr inbounds i8, i8* %ptr, i16 %idx.ext %cmp.ptr.n.upper = icmp ult i8* %ptr.n, %upper br i1 %cmp.ptr.n.upper, label %loop.header, label %trap @@ -197,16 +197,16 @@ trap: ret void loop.header: - %iv = phi i64 [ 0, %pre.1 ], [ %iv.next, %loop.latch ] - %ptr.iv = getelementptr inbounds i8, i8* %ptr, i64 %iv + %iv = phi i16 [ 0, %pre.1 ], [ %iv.next, %loop.latch ] + %ptr.iv = getelementptr inbounds i8, i8* %ptr, i16 %iv %cmp.ptr.iv.lower = icmp ugt i8* %lower, %ptr.iv %cmp.ptr.iv.upper = icmp ule i8* %upper, %ptr.iv %or = or i1 %cmp.ptr.iv.lower, %cmp.ptr.iv.upper br i1 %or, label %trap, label %loop.body loop.body: - %iv.1 = add nuw nsw i64 %iv, 1 - %ptr.iv.1 = getelementptr inbounds i8, i8* %ptr, i64 %iv.1 + %iv.1 = add nuw nsw i16 %iv, 1 + %ptr.iv.1 = getelementptr inbounds i8, i8* %ptr, i16 %iv.1 %cmp.ptr.iv.1.lower = icmp ugt i8* %lower, %ptr.iv.1 %cmp.ptr.iv.1.upper = icmp ule i8* %upper, %ptr.iv.1 %or.1 = or i1 %cmp.ptr.iv.1.lower, %cmp.ptr.iv.1.upper @@ -214,8 +214,8 @@ loop.body: loop.latch: store i8 0, i8* %ptr.iv, align 4 - %iv.next = add nuw nsw i64 %iv, 1 - %exitcond = icmp ne i64 %iv.next, %idx.ext + %iv.next = add nuw nsw i16 %iv, 1 + %exitcond = icmp ne i16 %iv.next, %idx.ext br i1 %exitcond, label %loop.header, label %exit exit: diff --git a/llvm/test/Transforms/ConstraintElimination/or.ll b/llvm/test/Transforms/ConstraintElimination/or.ll index 1653c5c..aed6774 100644 --- a/llvm/test/Transforms/ConstraintElimination/or.ll +++ b/llvm/test/Transforms/ConstraintElimination/or.ll @@ -3,123 +3,123 @@ declare void @use(i1) -define i32 @test_or_ule(i32 %x, i32 %y, i32 %z, i32 %a) { +define void @test_or_ule(i4 %x, i4 %y, i4 %z, i4 %a) { ; CHECK-LABEL: @test_or_ule( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[Y]], [[Z:%.*]] +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i4 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i4 [[Y]], [[Z:%.*]] ; CHECK-NEXT: [[OR:%.*]] = or i1 [[C_1]], [[C_2]] ; CHECK-NEXT: br i1 [[OR]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[X]], [[Z]] +; CHECK-NEXT: [[C_3:%.*]] = icmp ule i4 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp ule i32 [[X]], [[A:%.*]] +; CHECK-NEXT: [[C_4:%.*]] = icmp ule i4 [[X]], [[A:%.*]] ; CHECK-NEXT: call void @use(i1 [[C_4]]) -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: ret void ; CHECK: exit: -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i32 [[X]], [[Z]] +; CHECK-NEXT: [[F_1:%.*]] = icmp ule i4 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_5:%.*]] = icmp ule i32 [[X]], [[A]] +; CHECK-NEXT: [[C_5:%.*]] = icmp ule i4 [[X]], [[A]] ; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i32 [[Y]], [[Z]] +; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i4 [[Y]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i32 [[X]], [[Y]] +; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i4 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i32 [[X]], [[Z]] +; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i4 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: ret void ; entry: - %c.1 = icmp ule i32 %x, %y - %c.2 = icmp ule i32 %y, %z + %c.1 = icmp ule i4 %x, %y + %c.2 = icmp ule i4 %y, %z %or = or i1 %c.1, %c.2 br i1 %or, label %bb1, label %exit bb1: - %c.3 = icmp ule i32 %x, %z + %c.3 = icmp ule i4 %x, %z call void @use(i1 %c.3) - %c.4 = icmp ule i32 %x, %a + %c.4 = icmp ule i4 %x, %a call void @use(i1 %c.4) - ret i32 10 + ret void exit: - %f.1 = icmp ule i32 %x, %z + %f.1 = icmp ule i4 %x, %z call void @use(i1 %f.1) - %c.5 = icmp ule i32 %x, %a + %c.5 = icmp ule i4 %x, %a call void @use(i1 %c.5) - %t.1 = icmp ugt i32 %y, %z + %t.1 = icmp ugt i4 %y, %z call void @use(i1 %t.1) - %t.2 = icmp ugt i32 %x, %y + %t.2 = icmp ugt i4 %x, %y call void @use(i1 %t.2) - %t.3 = icmp ugt i32 %x, %z + %t.3 = icmp ugt i4 %x, %z call void @use(i1 %t.3) - ret i32 20 + ret void } ; The result of test_or_ule and test_or_select_ule should be same -define i32 @test_or_select_ule(i32 %x, i32 %y, i32 %z, i32 %a) { +define void @test_or_select_ule(i4 %x, i4 %y, i4 %z, i4 %a) { ; CHECK-LABEL: @test_or_select_ule( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[Y]], [[Z:%.*]] +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i4 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i4 [[Y]], [[Z:%.*]] ; CHECK-NEXT: [[OR:%.*]] = select i1 [[C_1]], i1 true, i1 [[C_2]] ; CHECK-NEXT: br i1 [[OR]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[X]], [[Z]] +; CHECK-NEXT: [[C_3:%.*]] = icmp ule i4 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp ule i32 [[X]], [[A:%.*]] +; CHECK-NEXT: [[C_4:%.*]] = icmp ule i4 [[X]], [[A:%.*]] ; CHECK-NEXT: call void @use(i1 [[C_4]]) -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: ret void ; CHECK: exit: -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i32 [[X]], [[Z]] +; CHECK-NEXT: [[F_1:%.*]] = icmp ule i4 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_5:%.*]] = icmp ule i32 [[X]], [[A]] +; CHECK-NEXT: [[C_5:%.*]] = icmp ule i4 [[X]], [[A]] ; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i32 [[Y]], [[Z]] +; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i4 [[Y]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i32 [[X]], [[Y]] +; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i4 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i32 [[X]], [[Z]] +; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i4 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: ret void ; entry: - %c.1 = icmp ule i32 %x, %y - %c.2 = icmp ule i32 %y, %z + %c.1 = icmp ule i4 %x, %y + %c.2 = icmp ule i4 %y, %z %or = select i1 %c.1, i1 true, i1 %c.2 br i1 %or, label %bb1, label %exit bb1: - %c.3 = icmp ule i32 %x, %z + %c.3 = icmp ule i4 %x, %z call void @use(i1 %c.3) - %c.4 = icmp ule i32 %x, %a + %c.4 = icmp ule i4 %x, %a call void @use(i1 %c.4) - ret i32 10 + ret void exit: - %f.1 = icmp ule i32 %x, %z + %f.1 = icmp ule i4 %x, %z call void @use(i1 %f.1) - %c.5 = icmp ule i32 %x, %a + %c.5 = icmp ule i4 %x, %a call void @use(i1 %c.5) - %t.1 = icmp ugt i32 %y, %z + %t.1 = icmp ugt i4 %y, %z call void @use(i1 %t.1) - %t.2 = icmp ugt i32 %x, %y + %t.2 = icmp ugt i4 %x, %y call void @use(i1 %t.2) - %t.3 = icmp ugt i32 %x, %z + %t.3 = icmp ugt i4 %x, %z call void @use(i1 %t.3) - ret i32 20 + ret void } diff --git a/llvm/test/Transforms/ConstraintElimination/uge.ll b/llvm/test/Transforms/ConstraintElimination/uge.ll index bacb9a7..7ff37fc 100644 --- a/llvm/test/Transforms/ConstraintElimination/uge.ll +++ b/llvm/test/Transforms/ConstraintElimination/uge.ll @@ -3,253 +3,251 @@ declare void @use(i1) -define void @test_1_variable_constraint(i32 %x, i32 %y, i32 %z) { +define void @test_1_variable_constraint(i8 %x, i8 %y, i8 %z) { ; CHECK-LABEL: @test_1_variable_constraint( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp uge i32 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i32 [[X]], [[Y]] +; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[C_2:%.*]] = icmp uge i32 [[X]], 10 +; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_3:%.*]] = icmp uge i32 [[Y]], [[X]] +; CHECK-NEXT: [[C_3:%.*]] = icmp uge i8 [[Y]], [[X]] ; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp uge i32 10, [[X]] +; CHECK-NEXT: [[C_4:%.*]] = icmp uge i8 10, [[X]] ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: ret void ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp uge i32 [[Y]], [[X]] +; CHECK-NEXT: [[T_2:%.*]] = icmp uge i8 [[Y]], [[X]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i32 [[X]], [[Y]] +; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_5:%.*]] = icmp uge i32 [[X]], 10 +; CHECK-NEXT: [[C_5:%.*]] = icmp uge i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp uge i32 10, [[X]] +; CHECK-NEXT: [[C_6:%.*]] = icmp uge i8 10, [[X]] ; CHECK-NEXT: call void @use(i1 [[C_6]]) ; CHECK-NEXT: ret void ; entry: - %c.1 = icmp uge i32 %x, %y + %c.1 = icmp uge i8 %x, %y br i1 %c.1, label %bb1, label %bb2 bb1: - %t.1 = icmp uge i32 %x, %y + %t.1 = icmp uge i8 %x, %y call void @use(i1 %t.1) - %c.2 = icmp uge i32 %x, 10 + %c.2 = icmp uge i8 %x, 10 call void @use(i1 %c.2) - %c.3 = icmp uge i32 %y, %x + %c.3 = icmp uge i8 %y, %x call void @use(i1 %c.3) - %c.4 = icmp uge i32 10, %x + %c.4 = icmp uge i8 10, %x call void @use(i1 %c.4) ret void bb2: - %t.2 = icmp uge i32 %y, %x + %t.2 = icmp uge i8 %y, %x call void @use(i1 %t.2) - %f.1 = icmp uge i32 %x, %y + %f.1 = icmp uge i8 %x, %y call void @use(i1 %f.1) - %c.5 = icmp uge i32 %x, 10 + %c.5 = icmp uge i8 %x, 10 call void @use(i1 %c.5) - %c.6 = icmp uge i32 10, %x + %c.6 = icmp uge i8 10, %x call void @use(i1 %c.6) ret void } -define void @test_1_constant_constraint(i32 %x) { +define void @test_1_constant_constraint(i8 %x) { ; CHECK-LABEL: @test_1_constant_constraint( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp uge i32 [[X:%.*]], 10 +; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i32 [[X]], 10 +; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_2:%.*]] = icmp uge i32 [[X]], 9 +; CHECK-NEXT: [[T_2:%.*]] = icmp uge i8 [[X]], 9 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[C_2:%.*]] = icmp uge i32 [[X]], 11 +; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[X]], 11 ; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp uge i32 10, [[X]] +; CHECK-NEXT: [[C_4:%.*]] = icmp uge i8 10, [[X]] ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: ret void ; CHECK: bb2: -; CHECK-NEXT: [[T_3:%.*]] = icmp uge i32 11, [[X]] +; CHECK-NEXT: [[T_3:%.*]] = icmp uge i8 11, [[X]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i32 [[X]], 10 +; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[F_1_1:%.*]] = icmp uge i32 [[X]], 10 +; CHECK-NEXT: [[F_1_1:%.*]] = icmp uge i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_5:%.*]] = icmp uge i32 [[X]], 9 +; CHECK-NEXT: [[C_5:%.*]] = icmp uge i8 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp uge i32 1, [[X]] +; CHECK-NEXT: [[C_6:%.*]] = icmp uge i8 1, [[X]] ; CHECK-NEXT: call void @use(i1 [[C_6]]) ; CHECK-NEXT: ret void ; entry: - %c.1 = icmp uge i32 %x, 10 + %c.1 = icmp uge i8 %x, 10 br i1 %c.1, label %bb1, label %bb2 bb1: - %t.1 = icmp uge i32 %x, 10 + %t.1 = icmp uge i8 %x, 10 call void @use(i1 %t.1) - %t.2 = icmp uge i32 %x, 9 + %t.2 = icmp uge i8 %x, 9 call void @use(i1 %t.2) - %c.2 = icmp uge i32 %x, 11 + %c.2 = icmp uge i8 %x, 11 call void @use(i1 %c.2) - %c.4 = icmp uge i32 10, %x + %c.4 = icmp uge i8 10, %x call void @use(i1 %c.4) ret void bb2: - %t.3 = icmp uge i32 11, %x + %t.3 = icmp uge i8 11, %x call void @use(i1 %t.3) - %f.1 = icmp uge i32 %x, 10 + %f.1 = icmp uge i8 %x, 10 call void @use(i1 %f.1) - %f.1.1 = icmp uge i32 %x, 10 + %f.1.1 = icmp uge i8 %x, 10 call void @use(i1 %f.1.1) - %c.5 = icmp uge i32 %x, 9 + %c.5 = icmp uge i8 %x, 9 call void @use(i1 %c.5) - %c.6 = icmp uge i32 1, %x + %c.6 = icmp uge i8 1, %x call void @use(i1 %c.6) ret void } -define i32 @test1(i32 %x, i32 %y, i32 %z) { +define i8 @test1(i8 %x, i8 %y, i8 %z) { ; CHECK-LABEL: @test1( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp uge i32 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp uge i32 [[Y]], [[Z:%.*]] +; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y]], [[Z:%.*]] ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp uge i32 [[X]], [[Z]] +; CHECK-NEXT: [[C_3:%.*]] = icmp uge i8 [[X]], [[Z]] ; CHECK-NEXT: br i1 true, label [[BB3:%.*]], label [[EXIT]] ; CHECK: bb3: -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: ret i8 10 ; CHECK: exit: -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: ret i8 20 ; entry: - %c.1 = icmp uge i32 %x, %y + %c.1 = icmp uge i8 %x, %y br i1 %c.1, label %bb1, label %exit bb1: - %c.2 = icmp uge i32 %y, %z + %c.2 = icmp uge i8 %y, %z br i1 %c.2, label %bb2, label %exit bb2: - %c.3 = icmp uge i32 %x, %z + %c.3 = icmp uge i8 %x, %z br i1 %c.3, label %bb3, label %exit bb3: - ret i32 10 + ret i8 10 exit: - ret i32 20 + ret i8 20 } -define i32 @test2(i32 %x, i32 %y, i32 %z, i32 %a) { +define i8 @test2(i8 %x, i8 %y, i8 %z, i8 %a) { ; CHECK-LABEL: @test2( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp uge i32 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp uge i32 [[Y]], [[Z:%.*]] +; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y]], [[Z:%.*]] ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp uge i32 [[X]], [[A:%.*]] +; CHECK-NEXT: [[C_3:%.*]] = icmp uge i8 [[X]], [[A:%.*]] ; CHECK-NEXT: br i1 [[C_3]], label [[BB3:%.*]], label [[EXIT]] ; CHECK: bb3: -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: ret i8 10 ; CHECK: exit: -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: ret i8 20 ; entry: - %c.1 = icmp uge i32 %x, %y + %c.1 = icmp uge i8 %x, %y br i1 %c.1, label %bb1, label %exit bb1: - %c.2 = icmp uge i32 %y, %z + %c.2 = icmp uge i8 %y, %z br i1 %c.2, label %bb2, label %exit bb2: - %c.3 = icmp uge i32 %x, %a + %c.3 = icmp uge i8 %x, %a br i1 %c.3, label %bb3, label %exit bb3: - ret i32 10 + ret i8 10 exit: - ret i32 20 + ret i8 20 } -define i32 @test3(i32 %x, i32 %y) { +define i8 @test3(i8 %x, i8 %y) { ; CHECK-LABEL: @test3( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp uge i32 [[X:%.*]], 10 +; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp uge i32 [[Y:%.*]], 20 +; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y:%.*]], 20 ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: ret i8 10 ; CHECK: exit: -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: ret i8 20 ; entry: - %c.1 = icmp uge i32 %x, 10 + %c.1 = icmp uge i8 %x, 10 br i1 %c.1, label %bb1, label %exit bb1: - %c.2 = icmp uge i32 %y, 20 + %c.2 = icmp uge i8 %y, 20 br i1 %c.2, label %bb2, label %exit bb2: - ret i32 10 + ret i8 10 exit: - ret i32 20 + ret i8 20 } -define i32 @test4(i32 %x, i32 %y, i32 %z) { +define i8 @test4(i8 %x, i8 %y, i8 %z) { ; CHECK-LABEL: @test4( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp uge i32 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp uge i32 [[Y]], [[Z:%.*]] +; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y]], [[Z:%.*]] ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i32 [[X]], [[Z]] +; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[U_1:%.*]] = icmp eq i32 [[X]], [[Z]] +; CHECK-NEXT: [[U_1:%.*]] = icmp eq i8 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 [[U_1]]) -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: ret i8 10 ; CHECK: exit: -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: ret i8 20 ; entry: - %c.1 = icmp uge i32 %x, %y + %c.1 = icmp uge i8 %x, %y br i1 %c.1, label %bb1, label %exit bb1: - %c.2 = icmp uge i32 %y, %z + %c.2 = icmp uge i8 %y, %z br i1 %c.2, label %bb2, label %exit bb2: - %t.1 = icmp uge i32 %x, %z + %t.1 = icmp uge i8 %x, %z call void @use(i1 %t.1) - %u.1 = icmp eq i32 %x, %z + %u.1 = icmp eq i8 %x, %z call void @use(i1 %u.1) - ret i32 10 + ret i8 10 exit: - ret i32 20 + ret i8 20 } - - diff --git a/llvm/test/Transforms/ConstraintElimination/ule.ll b/llvm/test/Transforms/ConstraintElimination/ule.ll index c535655..69c55f5 100644 --- a/llvm/test/Transforms/ConstraintElimination/ule.ll +++ b/llvm/test/Transforms/ConstraintElimination/ule.ll @@ -3,252 +3,252 @@ declare void @use(i1) -define void @test_1_variable_constraint(i32 %x, i32 %y, i32 %z) { +define void @test_1_variable_constraint(i8 %x, i8 %y, i8 %z) { ; CHECK-LABEL: @test_1_variable_constraint( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[X]], [[Y]] +; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 10 +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[Y]], [[X]] +; CHECK-NEXT: [[C_3:%.*]] = icmp ule i8 [[Y]], [[X]] ; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp ule i32 10, [[X]] +; CHECK-NEXT: [[C_4:%.*]] = icmp ule i8 10, [[X]] ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: ret void ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i32 [[Y]], [[X]] +; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[Y]], [[X]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i32 [[X]], [[Y]] +; CHECK-NEXT: [[F_1:%.*]] = icmp ule i8 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_5:%.*]] = icmp ule i32 [[X]], 10 +; CHECK-NEXT: [[C_5:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp ule i32 10, [[X]] +; CHECK-NEXT: [[C_6:%.*]] = icmp ule i8 10, [[X]] ; CHECK-NEXT: call void @use(i1 [[C_6]]) ; CHECK-NEXT: ret void ; entry: - %c.1 = icmp ule i32 %x, %y + %c.1 = icmp ule i8 %x, %y br i1 %c.1, label %bb1, label %bb2 bb1: - %t.1 = icmp ule i32 %x, %y + %t.1 = icmp ule i8 %x, %y call void @use(i1 %t.1) - %c.2 = icmp ule i32 %x, 10 + %c.2 = icmp ule i8 %x, 10 call void @use(i1 %c.2) - %c.3 = icmp ule i32 %y, %x + %c.3 = icmp ule i8 %y, %x call void @use(i1 %c.3) - %c.4 = icmp ule i32 10, %x + %c.4 = icmp ule i8 10, %x call void @use(i1 %c.4) ret void bb2: - %t.2 = icmp ule i32 %y, %x + %t.2 = icmp ule i8 %y, %x call void @use(i1 %t.2) - %f.1 = icmp ule i32 %x, %y + %f.1 = icmp ule i8 %x, %y call void @use(i1 %f.1) - %c.5 = icmp ule i32 %x, 10 + %c.5 = icmp ule i8 %x, 10 call void @use(i1 %c.5) - %c.6 = icmp ule i32 10, %x + %c.6 = icmp ule i8 10, %x call void @use(i1 %c.6) ret void } -define void @test_1_constant_constraint(i32 %x) { +define void @test_1_constant_constraint(i8 %x) { ; CHECK-LABEL: @test_1_constant_constraint( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], 10 +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[X]], 10 +; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i32 [[X]], 11 +; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[X]], 11 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 9 +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp ule i32 10, [[X]] +; CHECK-NEXT: [[C_4:%.*]] = icmp ule i8 10, [[X]] ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: ret void ; CHECK: bb2: -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i32 10, [[X]] +; CHECK-NEXT: [[T_3:%.*]] = icmp ule i8 10, [[X]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i32 [[X]], 9 +; CHECK-NEXT: [[F_1:%.*]] = icmp ule i8 [[X]], 9 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[F_1_1:%.*]] = icmp ule i32 [[X]], 10 +; CHECK-NEXT: [[F_1_1:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_5:%.*]] = icmp ule i32 [[X]], 11 +; CHECK-NEXT: [[C_5:%.*]] = icmp ule i8 [[X]], 11 ; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp ule i32 12, [[X]] +; CHECK-NEXT: [[C_6:%.*]] = icmp ule i8 12, [[X]] ; CHECK-NEXT: call void @use(i1 [[C_6]]) ; CHECK-NEXT: ret void ; entry: - %c.1 = icmp ule i32 %x, 10 + %c.1 = icmp ule i8 %x, 10 br i1 %c.1, label %bb1, label %bb2 bb1: - %t.1 = icmp ule i32 %x, 10 + %t.1 = icmp ule i8 %x, 10 call void @use(i1 %t.1) - %t.2 = icmp ule i32 %x, 11 + %t.2 = icmp ule i8 %x, 11 call void @use(i1 %t.2) - %c.2 = icmp ule i32 %x, 9 + %c.2 = icmp ule i8 %x, 9 call void @use(i1 %c.2) - %c.4 = icmp ule i32 10, %x + %c.4 = icmp ule i8 10, %x call void @use(i1 %c.4) ret void bb2: - %t.3 = icmp ule i32 10, %x + %t.3 = icmp ule i8 10, %x call void @use(i1 %t.3) - %f.1 = icmp ule i32 %x, 9 + %f.1 = icmp ule i8 %x, 9 call void @use(i1 %f.1) - %f.1.1 = icmp ule i32 %x, 10 + %f.1.1 = icmp ule i8 %x, 10 call void @use(i1 %f.1.1) - %c.5 = icmp ule i32 %x, 11 + %c.5 = icmp ule i8 %x, 11 call void @use(i1 %c.5) - %c.6 = icmp ule i32 12, %x + %c.6 = icmp ule i8 12, %x call void @use(i1 %c.6) ret void } -define i32 @test1(i32 %x, i32 %y, i32 %z) { +define i8 @test1(i8 %x, i8 %y, i8 %z) { ; CHECK-LABEL: @test1( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[Y]], [[Z:%.*]] +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[Y]], [[Z:%.*]] ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[X]], [[Z]] +; CHECK-NEXT: [[C_3:%.*]] = icmp ule i8 [[X]], [[Z]] ; CHECK-NEXT: br i1 true, label [[BB3:%.*]], label [[EXIT]] ; CHECK: bb3: -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: ret i8 10 ; CHECK: exit: -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: ret i8 20 ; entry: - %c.1 = icmp ule i32 %x, %y + %c.1 = icmp ule i8 %x, %y br i1 %c.1, label %bb1, label %exit bb1: - %c.2 = icmp ule i32 %y, %z + %c.2 = icmp ule i8 %y, %z br i1 %c.2, label %bb2, label %exit bb2: - %c.3 = icmp ule i32 %x, %z + %c.3 = icmp ule i8 %x, %z br i1 %c.3, label %bb3, label %exit bb3: - ret i32 10 + ret i8 10 exit: - ret i32 20 + ret i8 20 } -define i32 @test2(i32 %x, i32 %y, i32 %z, i32 %a) { +define i8 @test2(i8 %x, i8 %y, i8 %z, i8 %a) { ; CHECK-LABEL: @test2( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[Y]], [[Z:%.*]] +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[Y]], [[Z:%.*]] ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[X]], [[A:%.*]] +; CHECK-NEXT: [[C_3:%.*]] = icmp ule i8 [[X]], [[A:%.*]] ; CHECK-NEXT: br i1 [[C_3]], label [[BB3:%.*]], label [[EXIT]] ; CHECK: bb3: -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: ret i8 10 ; CHECK: exit: -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: ret i8 20 ; entry: - %c.1 = icmp ule i32 %x, %y + %c.1 = icmp ule i8 %x, %y br i1 %c.1, label %bb1, label %exit bb1: - %c.2 = icmp ule i32 %y, %z + %c.2 = icmp ule i8 %y, %z br i1 %c.2, label %bb2, label %exit bb2: - %c.3 = icmp ule i32 %x, %a + %c.3 = icmp ule i8 %x, %a br i1 %c.3, label %bb3, label %exit bb3: - ret i32 10 + ret i8 10 exit: - ret i32 20 + ret i8 20 } -define i32 @test3(i32 %x, i32 %y) { +define i8 @test3(i8 %x, i8 %y) { ; CHECK-LABEL: @test3( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], 10 +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[Y:%.*]], 20 +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[Y:%.*]], 20 ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: ret i8 10 ; CHECK: exit: -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: ret i8 20 ; entry: - %c.1 = icmp ule i32 %x, 10 + %c.1 = icmp ule i8 %x, 10 br i1 %c.1, label %bb1, label %exit bb1: - %c.2 = icmp ule i32 %y, 20 + %c.2 = icmp ule i8 %y, 20 br i1 %c.2, label %bb2, label %exit bb2: - ret i32 10 + ret i8 10 exit: - ret i32 20 + ret i8 20 } -define i32 @test4(i32 %x, i32 %y, i32 %z) { +define i8 @test4(i8 %x, i8 %y, i8 %z) { ; CHECK-LABEL: @test4( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[Y]], [[Z:%.*]] +; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[Y]], [[Z:%.*]] ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[X]], [[Z]] +; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[U_1:%.*]] = icmp eq i32 [[X]], [[Z]] +; CHECK-NEXT: [[U_1:%.*]] = icmp eq i8 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 [[U_1]]) -; CHECK-NEXT: ret i32 10 +; CHECK-NEXT: ret i8 10 ; CHECK: exit: -; CHECK-NEXT: ret i32 20 +; CHECK-NEXT: ret i8 20 ; entry: - %c.1 = icmp ule i32 %x, %y + %c.1 = icmp ule i8 %x, %y br i1 %c.1, label %bb1, label %exit bb1: - %c.2 = icmp ule i32 %y, %z + %c.2 = icmp ule i8 %y, %z br i1 %c.2, label %bb2, label %exit bb2: - %t.1 = icmp ule i32 %x, %z + %t.1 = icmp ule i8 %x, %z call void @use(i1 %t.1) - %u.1 = icmp eq i32 %x, %z + %u.1 = icmp eq i8 %x, %z call void @use(i1 %u.1) - ret i32 10 + ret i8 10 exit: - ret i32 20 + ret i8 20 } diff --git a/llvm/test/Transforms/ConstraintElimination/zext.ll b/llvm/test/Transforms/ConstraintElimination/zext.ll index a53f5a1..1393972 100644 --- a/llvm/test/Transforms/ConstraintElimination/zext.ll +++ b/llvm/test/Transforms/ConstraintElimination/zext.ll @@ -1,289 +1,266 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -constraint-elimination -S %s | FileCheck %s -declare void @use(i1) - -define void @uge_zext(i16 %x, i32 %y) { +define i1 @uge_zext(i8 %x, i16 %y) { ; CHECK-LABEL: @uge_zext( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[X_EXT:%.*]] = zext i16 [[X:%.*]] to i32 -; CHECK-NEXT: [[C_1:%.*]] = icmp uge i32 [[X_EXT]], [[Y:%.*]] +; CHECK-NEXT: [[X_EXT:%.*]] = zext i8 [[X:%.*]] to i16 +; CHECK-NEXT: [[C_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i32 [[X_EXT]], [[Y]] -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[C_2:%.*]] = icmp uge i32 [[X_EXT]], 10 -; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_3:%.*]] = icmp uge i32 [[Y]], [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp uge i32 10, [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_4]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[T_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y]] +; CHECK-NEXT: [[C_2:%.*]] = icmp uge i16 [[X_EXT]], 10 +; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, [[C_2]] +; CHECK-NEXT: [[C_3:%.*]] = icmp uge i16 [[Y]], [[X_EXT]] +; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_3]] +; CHECK-NEXT: [[C_4:%.*]] = icmp uge i16 10, [[X_EXT]] +; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_4]] +; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp uge i32 [[Y]], [[X_EXT]] -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i32 [[X_EXT]], [[Y]] -; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_5:%.*]] = icmp uge i32 [[X_EXT]], 10 -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp uge i32 10, [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_6]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[T_2:%.*]] = icmp uge i16 [[Y]], [[X_EXT]] +; CHECK-NEXT: [[F_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y]] +; CHECK-NEXT: [[R_4:%.*]] = xor i1 true, false +; CHECK-NEXT: [[C_5:%.*]] = icmp uge i16 [[X_EXT]], 10 +; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_5]] +; CHECK-NEXT: [[C_6:%.*]] = icmp uge i16 10, [[X_EXT]] +; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_6]] +; CHECK-NEXT: ret i1 [[R_6]] ; entry: - %x.ext = zext i16 %x to i32 - %c.1 = icmp uge i32 %x.ext, %y + %x.ext = zext i8 %x to i16 + %c.1 = icmp uge i16 %x.ext, %y br i1 %c.1, label %bb1, label %bb2 bb1: - %t.1 = icmp uge i32 %x.ext, %y - call void @use(i1 %t.1) - %c.2 = icmp uge i32 %x.ext, 10 - call void @use(i1 %c.2) - %c.3 = icmp uge i32 %y, %x.ext - call void @use(i1 %c.3) - %c.4 = icmp uge i32 10, %x.ext - call void @use(i1 %c.4) - ret void + %t.1 = icmp uge i16 %x.ext, %y + %c.2 = icmp uge i16 %x.ext, 10 + %r.1 = xor i1 %t.1, %c.2 + %c.3 = icmp uge i16 %y, %x.ext + %r.2 = xor i1 %r.1, %c.3 + %c.4 = icmp uge i16 10, %x.ext + %r.3 = xor i1 %r.2, %c.4 + ret i1 %r.3 bb2: - %t.2 = icmp uge i32 %y, %x.ext - call void @use(i1 %t.2) - %f.1 = icmp uge i32 %x.ext, %y - call void @use(i1 %f.1) - %c.5 = icmp uge i32 %x.ext, 10 - call void @use(i1 %c.5) - %c.6 = icmp uge i32 10, %x.ext - call void @use(i1 %c.6) - ret void + %t.2 = icmp uge i16 %y, %x.ext + %f.1 = icmp uge i16 %x.ext, %y + %r.4 = xor i1 %t.2, %f.1 + %c.5 = icmp uge i16 %x.ext, 10 + %r.5 = xor i1 %r.4, %c.5 + %c.6 = icmp uge i16 10, %x.ext + %r.6 = xor i1 %r.5, %c.6 + ret i1 %r.6 } -define void @uge_compare_short_and_extended(i16 %x, i16 %y) { +define i1 @uge_compare_short_and_extended(i8 %x, i8 %y) { ; CHECK-LABEL: @uge_compare_short_and_extended( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp uge i16 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[X_EXT:%.*]] = zext i16 [[X]] to i32 -; CHECK-NEXT: [[Y_EXT:%.*]] = zext i16 [[Y]] to i32 +; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[X_EXT:%.*]] = zext i8 [[X]] to i16 +; CHECK-NEXT: [[Y_EXT:%.*]] = zext i8 [[Y]] to i16 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i32 [[X_EXT]], [[Y_EXT]] -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[C_2:%.*]] = icmp uge i32 [[X_EXT]], 10 -; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_3:%.*]] = icmp sge i32 [[Y_EXT]], [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp uge i32 10, [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_4]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[T_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y_EXT]] +; CHECK-NEXT: [[C_2:%.*]] = icmp uge i16 [[X_EXT]], 10 +; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, [[C_2]] +; CHECK-NEXT: [[C_3:%.*]] = icmp sge i16 [[Y_EXT]], [[X_EXT]] +; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_3]] +; CHECK-NEXT: [[C_4:%.*]] = icmp uge i16 10, [[X_EXT]] +; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_4]] +; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp uge i32 [[Y_EXT]], [[X_EXT]] -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i32 [[X_EXT]], [[Y_EXT]] -; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_5:%.*]] = icmp uge i32 [[X_EXT]], 10 -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp uge i32 10, [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_6]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[T_2:%.*]] = icmp uge i16 [[Y_EXT]], [[X_EXT]] +; CHECK-NEXT: [[F_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y_EXT]] +; CHECK-NEXT: [[R_4:%.*]] = xor i1 true, false +; CHECK-NEXT: [[C_5:%.*]] = icmp uge i16 [[X_EXT]], 10 +; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_5]] +; CHECK-NEXT: [[C_6:%.*]] = icmp uge i16 10, [[X_EXT]] +; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_6]] +; CHECK-NEXT: ret i1 [[R_6]] ; entry: - %c.1 = icmp uge i16 %x, %y - %x.ext = zext i16 %x to i32 - %y.ext = zext i16 %y to i32 + %c.1 = icmp uge i8 %x, %y + %x.ext = zext i8 %x to i16 + %y.ext = zext i8 %y to i16 br i1 %c.1, label %bb1, label %bb2 bb1: - %t.1 = icmp uge i32 %x.ext, %y.ext - call void @use(i1 %t.1) - %c.2 = icmp uge i32 %x.ext, 10 - call void @use(i1 %c.2) - %c.3 = icmp sge i32 %y.ext, %x.ext - call void @use(i1 %c.3) - %c.4 = icmp uge i32 10, %x.ext - call void @use(i1 %c.4) - ret void + %t.1 = icmp uge i16 %x.ext, %y.ext + %c.2 = icmp uge i16 %x.ext, 10 + %r.1 = xor i1 %t.1, %c.2 + %c.3 = icmp sge i16 %y.ext, %x.ext + %r.2 = xor i1 %r.1, %c.3 + %c.4 = icmp uge i16 10, %x.ext + %r.3 = xor i1 %r.2, %c.4 + ret i1 %r.3 bb2: - %t.2 = icmp uge i32 %y.ext, %x.ext - call void @use(i1 %t.2) - %f.1 = icmp uge i32 %x.ext, %y.ext - call void @use(i1 %f.1) - %c.5 = icmp uge i32 %x.ext, 10 - call void @use(i1 %c.5) - %c.6 = icmp uge i32 10, %x.ext - call void @use(i1 %c.6) - ret void + %t.2 = icmp uge i16 %y.ext, %x.ext + %f.1 = icmp uge i16 %x.ext, %y.ext + %r.4 = xor i1 %t.2, %f.1 + %c.5 = icmp uge i16 %x.ext, 10 + %r.5 = xor i1 %r.4, %c.5 + %c.6 = icmp uge i16 10, %x.ext + %r.6 = xor i1 %r.5, %c.6 + ret i1 %r.6 } -define void @uge_zext_add(i16 %x, i32 %y) { +define i1 @uge_zext_add(i8 %x, i16 %y) { ; CHECK-LABEL: @uge_zext_add( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[X_ADD_1:%.*]] = add nuw nsw i16 [[X:%.*]], 1 -; CHECK-NEXT: [[X_ADD_1_EXT:%.*]] = zext i16 [[X_ADD_1]] to i32 -; CHECK-NEXT: [[X_EXT:%.*]] = zext i16 [[X]] to i32 -; CHECK-NEXT: [[C_1:%.*]] = icmp uge i32 [[X_ADD_1_EXT]], [[Y:%.*]] +; CHECK-NEXT: [[X_ADD_1:%.*]] = add nuw nsw i8 [[X:%.*]], 1 +; CHECK-NEXT: [[X_ADD_1_EXT:%.*]] = zext i8 [[X_ADD_1]] to i16 +; CHECK-NEXT: [[X_EXT:%.*]] = zext i8 [[X]] to i16 +; CHECK-NEXT: [[C_1:%.*]] = icmp uge i16 [[X_ADD_1_EXT]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i32 [[X_EXT]], [[Y]] -; CHECK-NEXT: call void @use(i1 [[T_1]]) -; CHECK-NEXT: [[C_2:%.*]] = icmp uge i32 [[X_EXT]], 10 -; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_3:%.*]] = icmp uge i32 [[Y]], [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp uge i32 10, [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_4]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[T_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y]] +; CHECK-NEXT: [[C_2:%.*]] = icmp uge i16 [[X_EXT]], 10 +; CHECK-NEXT: [[R_1:%.*]] = xor i1 [[T_1]], [[C_2]] +; CHECK-NEXT: [[C_3:%.*]] = icmp uge i16 [[Y]], [[X_EXT]] +; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_3]] +; CHECK-NEXT: [[C_4:%.*]] = icmp uge i16 10, [[X_EXT]] +; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_4]] +; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp uge i32 [[Y]], [[X_EXT]] -; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i32 [[X_EXT]], [[Y]] -; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_5:%.*]] = icmp uge i32 [[X_EXT]], 10 -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp uge i32 10, [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_6]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[T_2:%.*]] = icmp uge i16 [[Y]], [[X_EXT]] +; CHECK-NEXT: [[F_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y]] +; CHECK-NEXT: [[R_4:%.*]] = xor i1 true, false +; CHECK-NEXT: [[C_5:%.*]] = icmp uge i16 [[X_EXT]], 10 +; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_5]] +; CHECK-NEXT: [[C_6:%.*]] = icmp uge i16 10, [[X_EXT]] +; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_6]] +; CHECK-NEXT: ret i1 [[R_6]] ; entry: - %x.add.1 = add nuw nsw i16 %x, 1 - %x.add.1.ext = zext i16 %x.add.1 to i32 - %x.ext = zext i16 %x to i32 - %c.1 = icmp uge i32 %x.add.1.ext, %y + %x.add.1 = add nuw nsw i8 %x, 1 + %x.add.1.ext = zext i8 %x.add.1 to i16 + %x.ext = zext i8 %x to i16 + %c.1 = icmp uge i16 %x.add.1.ext, %y br i1 %c.1, label %bb1, label %bb2 bb1: - %t.1 = icmp uge i32 %x.ext, %y - call void @use(i1 %t.1) - %c.2 = icmp uge i32 %x.ext, 10 - call void @use(i1 %c.2) - %c.3 = icmp uge i32 %y, %x.ext - call void @use(i1 %c.3) - %c.4 = icmp uge i32 10, %x.ext - call void @use(i1 %c.4) - ret void + %t.1 = icmp uge i16 %x.ext, %y + %c.2 = icmp uge i16 %x.ext, 10 + %r.1 = xor i1 %t.1, %c.2 + %c.3 = icmp uge i16 %y, %x.ext + %r.2 = xor i1 %r.1, %c.3 + %c.4 = icmp uge i16 10, %x.ext + %r.3 = xor i1 %r.2, %c.4 + ret i1 %r.3 bb2: - %t.2 = icmp uge i32 %y, %x.ext - call void @use(i1 %t.2) - %f.1 = icmp uge i32 %x.ext, %y - call void @use(i1 %f.1) - %c.5 = icmp uge i32 %x.ext, 10 - call void @use(i1 %c.5) - %c.6 = icmp uge i32 10, %x.ext - call void @use(i1 %c.6) - ret void + %t.2 = icmp uge i16 %y, %x.ext + %f.1 = icmp uge i16 %x.ext, %y + %r.4 = xor i1 %t.2, %f.1 + %c.5 = icmp uge i16 %x.ext, 10 + %r.5 = xor i1 %r.4, %c.5 + %c.6 = icmp uge i16 10, %x.ext + %r.6 = xor i1 %r.5, %c.6 + ret i1 %r.6 } - -define void @sge_zext(i16 %x, i32 %y) { +define i1 @sge_zext(i8 %x, i16 %y) { ; CHECK-LABEL: @sge_zext( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[X_EXT:%.*]] = zext i16 [[X:%.*]] to i32 -; CHECK-NEXT: [[C_1:%.*]] = icmp sge i32 [[X_EXT]], [[Y:%.*]] +; CHECK-NEXT: [[X_EXT:%.*]] = zext i8 [[X:%.*]] to i16 +; CHECK-NEXT: [[C_1:%.*]] = icmp sge i16 [[X_EXT]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp sge i32 [[X_EXT]], [[Y]] -; CHECK-NEXT: call void @use(i1 [[T_1]]) -; CHECK-NEXT: [[C_2:%.*]] = icmp sge i32 [[X_EXT]], 10 -; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_3:%.*]] = icmp sge i32 [[Y]], [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp sge i32 10, [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_4]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[T_1:%.*]] = icmp sge i16 [[X_EXT]], [[Y]] +; CHECK-NEXT: [[C_2:%.*]] = icmp sge i16 [[X_EXT]], 10 +; CHECK-NEXT: [[R_1:%.*]] = xor i1 [[T_1]], [[C_2]] +; CHECK-NEXT: [[C_3:%.*]] = icmp sge i16 [[Y]], [[X_EXT]] +; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_3]] +; CHECK-NEXT: [[C_4:%.*]] = icmp sge i16 10, [[X_EXT]] +; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_4]] +; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp sge i32 [[Y]], [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[T_2]]) -; CHECK-NEXT: [[F_1:%.*]] = icmp sge i32 [[X_EXT]], [[Y]] -; CHECK-NEXT: call void @use(i1 [[F_1]]) -; CHECK-NEXT: [[C_5:%.*]] = icmp sge i32 [[X_EXT]], 10 -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp sge i32 10, [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_6]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[T_2:%.*]] = icmp sge i16 [[Y]], [[X_EXT]] +; CHECK-NEXT: [[F_1:%.*]] = icmp sge i16 [[X_EXT]], [[Y]] +; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[T_2]], [[F_1]] +; CHECK-NEXT: [[C_5:%.*]] = icmp sge i16 [[X_EXT]], 10 +; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_5]] +; CHECK-NEXT: [[C_6:%.*]] = icmp sge i16 10, [[X_EXT]] +; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_6]] +; CHECK-NEXT: ret i1 [[R_6]] ; entry: - %x.ext = zext i16 %x to i32 - %c.1 = icmp sge i32 %x.ext, %y + %x.ext = zext i8 %x to i16 + %c.1 = icmp sge i16 %x.ext, %y br i1 %c.1, label %bb1, label %bb2 bb1: - %t.1 = icmp sge i32 %x.ext, %y - call void @use(i1 %t.1) - %c.2 = icmp sge i32 %x.ext, 10 - call void @use(i1 %c.2) - %c.3 = icmp sge i32 %y, %x.ext - call void @use(i1 %c.3) - %c.4 = icmp sge i32 10, %x.ext - call void @use(i1 %c.4) - ret void + %t.1 = icmp sge i16 %x.ext, %y + %c.2 = icmp sge i16 %x.ext, 10 + %r.1 = xor i1 %t.1, %c.2 + %c.3 = icmp sge i16 %y, %x.ext + %r.2 = xor i1 %r.1, %c.3 + %c.4 = icmp sge i16 10, %x.ext + %r.3 = xor i1 %r.2, %c.4 + ret i1 %r.3 bb2: - %t.2 = icmp sge i32 %y, %x.ext - call void @use(i1 %t.2) - %f.1 = icmp sge i32 %x.ext, %y - call void @use(i1 %f.1) - %c.5 = icmp sge i32 %x.ext, 10 - call void @use(i1 %c.5) - %c.6 = icmp sge i32 10, %x.ext - call void @use(i1 %c.6) - ret void + %t.2 = icmp sge i16 %y, %x.ext + %f.1 = icmp sge i16 %x.ext, %y + %r.4 = xor i1 %t.2, %f.1 + %c.5 = icmp sge i16 %x.ext, 10 + %r.5 = xor i1 %r.4, %c.5 + %c.6 = icmp sge i16 10, %x.ext + %r.6 = xor i1 %r.5, %c.6 + ret i1 %r.6 } -define void @sge_compare_short_and_extended(i16 %x, i16 %y) { +define i1 @sge_compare_short_and_extended(i8 %x, i8 %y) { ; CHECK-LABEL: @sge_compare_short_and_extended( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C_1:%.*]] = icmp sge i16 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[X_EXT:%.*]] = zext i16 [[X]] to i32 -; CHECK-NEXT: [[Y_EXT:%.*]] = zext i16 [[Y]] to i32 +; CHECK-NEXT: [[C_1:%.*]] = icmp sge i8 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[X_EXT:%.*]] = zext i8 [[X]] to i16 +; CHECK-NEXT: [[Y_EXT:%.*]] = zext i8 [[Y]] to i16 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp sge i32 [[X_EXT]], [[Y_EXT]] -; CHECK-NEXT: call void @use(i1 [[T_1]]) -; CHECK-NEXT: [[C_2:%.*]] = icmp sge i32 [[X_EXT]], 10 -; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[C_3:%.*]] = icmp sge i32 [[Y_EXT]], [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_3]]) -; CHECK-NEXT: [[C_4:%.*]] = icmp sge i32 10, [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_4]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[T_1:%.*]] = icmp sge i16 [[X_EXT]], [[Y_EXT]] +; CHECK-NEXT: [[C_2:%.*]] = icmp sge i16 [[X_EXT]], 10 +; CHECK-NEXT: [[R_1:%.*]] = xor i1 [[T_1]], [[C_2]] +; CHECK-NEXT: [[C_3:%.*]] = icmp sge i16 [[Y_EXT]], [[X_EXT]] +; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_3]] +; CHECK-NEXT: [[C_4:%.*]] = icmp sge i16 10, [[X_EXT]] +; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_4]] +; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp sge i32 [[Y_EXT]], [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[T_2]]) -; CHECK-NEXT: [[F_1:%.*]] = icmp sge i32 [[X_EXT]], [[Y_EXT]] -; CHECK-NEXT: call void @use(i1 [[F_1]]) -; CHECK-NEXT: [[C_5:%.*]] = icmp sge i32 [[X_EXT]], 10 -; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[C_6:%.*]] = icmp sge i32 10, [[X_EXT]] -; CHECK-NEXT: call void @use(i1 [[C_6]]) -; CHECK-NEXT: ret void +; CHECK-NEXT: [[T_2:%.*]] = icmp sge i16 [[Y_EXT]], [[X_EXT]] +; CHECK-NEXT: [[F_1:%.*]] = icmp sge i16 [[X_EXT]], [[Y_EXT]] +; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[T_2]], [[F_1]] +; CHECK-NEXT: [[C_5:%.*]] = icmp sge i16 [[X_EXT]], 10 +; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_5]] +; CHECK-NEXT: [[C_6:%.*]] = icmp sge i16 10, [[X_EXT]] +; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_6]] +; CHECK-NEXT: ret i1 [[R_6]] ; entry: - %c.1 = icmp sge i16 %x, %y - %x.ext = zext i16 %x to i32 - %y.ext = zext i16 %y to i32 + %c.1 = icmp sge i8 %x, %y + %x.ext = zext i8 %x to i16 + %y.ext = zext i8 %y to i16 br i1 %c.1, label %bb1, label %bb2 bb1: - %t.1 = icmp sge i32 %x.ext, %y.ext - call void @use(i1 %t.1) - %c.2 = icmp sge i32 %x.ext, 10 - call void @use(i1 %c.2) - %c.3 = icmp sge i32 %y.ext, %x.ext - call void @use(i1 %c.3) - %c.4 = icmp sge i32 10, %x.ext - call void @use(i1 %c.4) - ret void + %t.1 = icmp sge i16 %x.ext, %y.ext + %c.2 = icmp sge i16 %x.ext, 10 + %r.1 = xor i1 %t.1, %c.2 + %c.3 = icmp sge i16 %y.ext, %x.ext + %r.2 = xor i1 %r.1, %c.3 + %c.4 = icmp sge i16 10, %x.ext + %r.3 = xor i1 %r.2, %c.4 + ret i1 %r.3 bb2: - %t.2 = icmp sge i32 %y.ext, %x.ext - call void @use(i1 %t.2) - %f.1 = icmp sge i32 %x.ext, %y.ext - call void @use(i1 %f.1) - %c.5 = icmp sge i32 %x.ext, 10 - call void @use(i1 %c.5) - %c.6 = icmp sge i32 10, %x.ext - call void @use(i1 %c.6) - ret void + %t.2 = icmp sge i16 %y.ext, %x.ext + %f.1 = icmp sge i16 %x.ext, %y.ext + %r.4 = xor i1 %t.2, %f.1 + %c.5 = icmp sge i16 %x.ext, 10 + %r.5 = xor i1 %r.4, %c.5 + %c.6 = icmp sge i16 10, %x.ext + %r.6 = xor i1 %r.5, %c.6 + ret i1 %r.6 }