|
| 1 | +; RUN: opt %s -disable-output -passes="jump-threading,print<lazy-value-info>" 2>&1 | FileCheck %s |
| 2 | + |
| 3 | +; first to populate the values. |
| 4 | + |
| 5 | +define i32 @constraint(i32 %a) { |
| 6 | +; CHECK-LABEL: LVI for function 'constraint': |
| 7 | +chklt64: |
| 8 | +; CHECK-LABEL: chklt64: |
| 9 | +; CHECK-NEXT: ; LatticeVal for: 'i32 %a' is: overdefined |
| 10 | +; CHECK-NEXT: ; LatticeVal for: ' %cmp = icmp slt i32 %a, 64' in BB: '%chklt64' is: overdefined |
| 11 | +; CHECK-NEXT: ; LatticeVal for: ' %cmp = icmp slt i32 %a, 64' in BB: '%chkgt0' is: constantrange<-1, 0> |
| 12 | +; CHECK-NEXT: ; LatticeVal for: ' %cmp = icmp slt i32 %a, 64' in BB: '%notinbounds' is: overdefined |
| 13 | +; CHECK-NEXT: %cmp = icmp slt i32 %a, 64 |
| 14 | +; CHECK-NEXT: ; LatticeVal for: ' br i1 %cmp, label %chkgt0, label %notinbounds' in BB: '%chklt64' is: overdefined |
| 15 | +; CHECK-NEXT: ; LatticeVal for: ' br i1 %cmp, label %chkgt0, label %notinbounds' in BB: '%chkgt0' is: overdefined |
| 16 | +; CHECK-NEXT: ; LatticeVal for: ' br i1 %cmp, label %chkgt0, label %notinbounds' in BB: '%notinbounds' is: overdefined |
| 17 | +; CHECK-NEXT: br i1 %cmp, label %chkgt0, label %notinbounds |
| 18 | + %cmp = icmp slt i32 %a, 64 |
| 19 | + br i1 %cmp, label %chkgt0, label %notinbounds |
| 20 | + |
| 21 | +chkgt0: |
| 22 | +; CHECK-LABEL: chkgt0: |
| 23 | +; CHECK-NEXT: ; LatticeVal for: 'i32 %a' is: constantrange<-2147483648, 64> |
| 24 | +; CHECK-NEXT: ; LatticeVal for: ' %cmp1 = icmp sgt i32 %a, 0' in BB: '%chkgt0' is: overdefined |
| 25 | +; CHECK-NEXT: ; LatticeVal for: ' %cmp1 = icmp sgt i32 %a, 0' in BB: '%inbounds' is: constantrange<-1, 0> |
| 26 | +; CHECK-NEXT: %cmp1 = icmp sgt i32 %a, 0 |
| 27 | +; CHECK-NEXT: ; LatticeVal for: ' br i1 %cmp1, label %inbounds, label %notinbounds' in BB: '%chkgt0' is: overdefined |
| 28 | +; CHECK-NEXT: ; LatticeVal for: ' br i1 %cmp1, label %inbounds, label %notinbounds' in BB: '%inbounds' is: overdefined |
| 29 | +; CHECK-NEXT: br i1 %cmp1, label %inbounds, label %notinbounds |
| 30 | + %cmp1 = icmp sgt i32 %a, 0 |
| 31 | + br i1 %cmp1, label %inbounds, label %notinbounds |
| 32 | + |
| 33 | +inbounds: |
| 34 | +; CHECK-LABEL: inbounds: |
| 35 | +; CHECK-NEXT: ; LatticeVal for: 'i32 %a' is: constantrange<1, 64> |
| 36 | +; CHECK-NEXT: ; LatticeVal for: ' ret i32 %a' in BB: '%inbounds' is: overdefined |
| 37 | +; CHECK-NEXT: ret i32 %a |
| 38 | + ret i32 %a |
| 39 | + |
| 40 | +notinbounds: |
| 41 | +; CHECK-LABEL: notinbounds: |
| 42 | +; CHECK-NEXT: ; LatticeVal for: 'i32 %a' is: constantrange<64, 1> |
| 43 | +; CHECK-NEXT: ; LatticeVal for: ' %sum = add i32 %a, 64' in BB: '%notinbounds' is: constantrange<128, 65> |
| 44 | +; CHECK-NEXT: %sum = add i32 %a, 64 |
| 45 | +; CHECK-NEXT: ; LatticeVal for: ' ret i32 %sum' in BB: '%notinbounds' is: overdefined |
| 46 | +; CHECK-NEXT: ret i32 %sum |
| 47 | + %sum = add i32 %a, 64 |
| 48 | + ret i32 %sum |
| 49 | +} |
0 commit comments