Skip to content

Commit b8b8f04

Browse files
committed
[ValueLattice] Go to overdefined in getRange() for full ranges.
This is was split off 4878aa3, as it can go in separately.
1 parent 3656558 commit b8b8f04

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

llvm/include/llvm/Analysis/ValueLattice.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ class ValueLatticeElement {
138138
return Res;
139139
}
140140
static ValueLatticeElement getRange(ConstantRange CR) {
141+
if (CR.isFullSet())
142+
return getOverdefined();
143+
141144
ValueLatticeElement Res;
142145
Res.markConstantRange(std::move(CR));
143146
return Res;

llvm/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ loop:
7272
%cnd1 = icmp sge i32 %iv, 0
7373
%cnd2 = icmp sgt i32 %iv2, 0
7474
; CHECK: %cnd2 = icmp sgt i32 %iv2, 0
75-
; CHECK: ; LatticeVal for: ' %cnd = and i1 %cnd1, %cnd2' in BB: '%loop' is: constantrange<-1, -1>
75+
; CHECK: ; LatticeVal for: ' %cnd = and i1 %cnd1, %cnd2' in BB: '%loop' is: overdefined
7676
; CHECK-DAG: ; LatticeVal for: ' %cnd = and i1 %cnd1, %cnd2' in BB: '%backedge' is: constantrange<-1, 0>
7777
; CHECK-DAG: ; LatticeVal for: ' %cnd = and i1 %cnd1, %cnd2' in BB: '%exit' is: overdefined
7878
; CHECK-NEXT: %cnd = and i1 %cnd1, %cnd2
@@ -92,7 +92,7 @@ backedge:
9292
; CHECK-NEXT: ; LatticeVal for: ' %cont2 = icmp sgt i32 %iv2.next, 0' in BB: '%backedge' is: overdefined
9393
; CHECK-NEXT: %cont2 = icmp sgt i32 %iv2.next, 0
9494
%cont2 = icmp sgt i32 %iv2.next, 0
95-
; CHECK-NEXT: ; LatticeVal for: ' %cont = and i1 %cont1, %cont2' in BB: '%backedge' is: constantrange<-1, -1>
95+
; CHECK-NEXT: ; LatticeVal for: ' %cont = and i1 %cont1, %cont2' in BB: '%backedge' is: overdefined
9696
; CHECK-NEXT: %cont = and i1 %cont1, %cont2
9797
%cont = and i1 %cont1, %cont2
9898
br i1 %cont, label %loop, label %exit

0 commit comments

Comments
 (0)