64 lines · plain
1; RUN: opt -passes=constraint-elimination -S -debug %s 2>&1 | FileCheck %s2 3; REQUIRES: asserts4 5define i1 @test_and_ule(i4 %x, i4 %y, i4 %z) {6; CHECK: Processing fact to add to the system: icmp ule i4 %x, %y7; CHECK-NEXT: Adding 'icmp ule i4 %x, %y'8; CHECK-NEXT: constraint: %x + -1 * %y <= 09 10; CHECK: Processing fact to add to the system: icmp ule i4 %y, %z11; CHECK-NEXT: Adding 'icmp ule i4 %y, %z'12; CHECK-NEXT: constraint: %y + -1 * %z <= 013 14; CHECK: Checking %t.1 = icmp ule i4 %x, %z15; CHECK: Condition icmp ule i4 %x, %z implied by dominating constraints16 17; CHECK: Removing %y + -1 * %z <= 018; CHECK: Removing %x + -1 * %y <= 019 20entry:21 %c.1 = icmp ule i4 %x, %y22 %c.2 = icmp ule i4 %y, %z23 %and = and i1 %c.1, %c.224 br i1 %and, label %bb1, label %exit25 26bb1:27 %t.1 = icmp ule i4 %x, %z28 ret i1 %t.129 30exit:31 %c.3 = icmp ule i4 %x, %z32 ret i1 %c.333}34 35define i1 @test_and_ugt(i4 %x, i4 %y, i4 %z) {36; CHECK: Processing fact to add to the system: icmp ugt i4 %x, %y37; CHECK-NEXT: Adding 'icmp ugt i4 %x, %y'38; CHECK-NEXT: constraint: -1 * %x + %y <= -139 40; CHECK: Processing fact to add to the system: icmp ugt i4 %y, %z41; CHECK-NEXT: Adding 'icmp ugt i4 %y, %z'42; CHECK-NEXT: constraint: -1 * %y + %z <= -143 44; CHECK: Checking %f.1 = icmp ule i4 %x, %z45; CHECK: Condition icmp ugt i4 %x, %z implied by dominating constraints46 47; CHECK: Removing -1 * %y + %z <= -148; CHECK: Removing -1 * %x + %y <= -149 50entry:51 %c.1 = icmp ugt i4 %x, %y52 %c.2 = icmp ugt i4 %y, %z53 %and = and i1 %c.1, %c.254 br i1 %and, label %bb1, label %exit55 56bb1:57 %f.1 = icmp ule i4 %x, %z58 ret i1 %f.159 60exit:61 %c.3 = icmp ule i4 %x, %z62 ret i1 %c.363}64