96 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s3 4define i1 @test_conds_single_use_in_different_blocks(i8 %x) {5; CHECK-LABEL: @test_conds_single_use_in_different_blocks(6; CHECK-NEXT: entry:7; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X:%.*]], 108; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[X]], 59; CHECK-NEXT: br i1 [[C_1]], label [[THEN:%.*]], label [[ELSE:%.*]]10; CHECK: then:11; CHECK-NEXT: ret i1 true12; CHECK: else:13; CHECK-NEXT: ret i1 [[C_2]]14;15entry:16 %c.1 = icmp ugt i8 %x, 1017 %t.1 = icmp ugt i8 %x, 518 %c.2 = icmp ugt i8 %x, 519 br i1 %c.1, label %then, label %else20 21then:22 ret i1 %t.123 24else:25 ret i1 %c.226}27 28 29define i1 @test_conds_single_use_in_different_blocks_2(i8 %x, i8 %y) {30; CHECK-LABEL: @test_conds_single_use_in_different_blocks_2(31; CHECK-NEXT: entry:32; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X:%.*]], 1033; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[Y:%.*]], [[X]]34; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i8 [[Y]], 535; CHECK-NEXT: br i1 [[C_1]], label [[THEN_1:%.*]], label [[ELSE:%.*]]36; CHECK: then.1:37; CHECK-NEXT: br i1 [[C_2]], label [[THEN_2:%.*]], label [[ELSE]]38; CHECK: then.2:39; CHECK-NEXT: ret i1 true40; CHECK: else:41; CHECK-NEXT: ret i1 [[C_3]]42;43entry:44 %c.1 = icmp ugt i8 %x, 1045 %t.1 = icmp ugt i8 %y, 546 %c.2 = icmp ugt i8 %y, %x47 %c.3 = icmp ugt i8 %y, 548 br i1 %c.1, label %then.1, label %else49 50then.1:51 br i1 %c.2, label %then.2, label %else52 53then.2:54 ret i1 %t.155 56else:57 ret i1 %c.358}59 60declare void @llvm.assume(i1)61 62; Only the use of %t.1 in %then.2 could be simplified, but not the one in63; %entry.64define i1 @test_conds_multiple_uses_in_different_blocks_2(i8 %x, i8 %y) {65; CHECK-LABEL: @test_conds_multiple_uses_in_different_blocks_2(66; CHECK-NEXT: entry:67; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X:%.*]], 1068; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[Y:%.*]], 569; CHECK-NEXT: call void @llvm.assume(i1 [[T_1]])70; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[Y]], [[X]]71; CHECK-NEXT: br i1 [[C_1]], label [[THEN_1:%.*]], label [[ELSE:%.*]]72; CHECK: then.1:73; CHECK-NEXT: br i1 [[C_2]], label [[THEN_2:%.*]], label [[ELSE]]74; CHECK: then.2:75; CHECK-NEXT: ret i1 true76; CHECK: else:77; CHECK-NEXT: ret i1 true78;79entry:80 %c.1 = icmp ugt i8 %x, 1081 %t.1 = icmp ugt i8 %y, 582 call void @llvm.assume(i1 %t.1)83 %c.2 = icmp ugt i8 %y, %x84 %c.3 = icmp ugt i8 %y, 585 br i1 %c.1, label %then.1, label %else86 87then.1:88 br i1 %c.2, label %then.2, label %else89 90then.2:91 ret i1 %t.192 93else:94 ret i1 %c.395}96