[llvm] b8b8f04 - [ValueLattice] Go to overdefined in getRange() for full ranges.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 14 12:55:15 PDT 2020


Author: Florian Hahn
Date: 2020-03-14T19:50:15Z
New Revision: b8b8f04c0dd809d37903a29c06f4b9583b481767

URL: https://github.com/llvm/llvm-project/commit/b8b8f04c0dd809d37903a29c06f4b9583b481767
DIFF: https://github.com/llvm/llvm-project/commit/b8b8f04c0dd809d37903a29c06f4b9583b481767.diff

LOG: [ValueLattice] Go to overdefined in getRange() for full ranges.

This is was split off 4878aa36d4aa27df644430139fab2734fde4a000,
as it can go in separately.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/ValueLattice.h
    llvm/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/ValueLattice.h b/llvm/include/llvm/Analysis/ValueLattice.h
index bc6bd854c3b1..a467a715fca8 100644
--- a/llvm/include/llvm/Analysis/ValueLattice.h
+++ b/llvm/include/llvm/Analysis/ValueLattice.h
@@ -138,6 +138,9 @@ class ValueLatticeElement {
     return Res;
   }
   static ValueLatticeElement getRange(ConstantRange CR) {
+    if (CR.isFullSet())
+      return getOverdefined();
+
     ValueLatticeElement Res;
     Res.markConstantRange(std::move(CR));
     return Res;

diff  --git a/llvm/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll b/llvm/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll
index 303c7c4c1564..63f9ec603ac1 100644
--- a/llvm/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll
+++ b/llvm/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll
@@ -72,7 +72,7 @@ loop:
   %cnd1 = icmp sge i32 %iv, 0
   %cnd2 = icmp sgt i32 %iv2, 0
 ; CHECK:       %cnd2 = icmp sgt i32 %iv2, 0
-; CHECK:         ; LatticeVal for: '  %cnd = and i1 %cnd1, %cnd2' in BB: '%loop' is: constantrange<-1, -1>
+; CHECK:         ; LatticeVal for: '  %cnd = and i1 %cnd1, %cnd2' in BB: '%loop' is: overdefined
 ; CHECK-DAG:     ; LatticeVal for: '  %cnd = and i1 %cnd1, %cnd2' in BB: '%backedge' is: constantrange<-1, 0>
 ; CHECK-DAG:     ; LatticeVal for: '  %cnd = and i1 %cnd1, %cnd2' in BB: '%exit' is: overdefined
 ; CHECK-NEXT:  %cnd = and i1 %cnd1, %cnd2
@@ -92,7 +92,7 @@ backedge:
 ; CHECK-NEXT:    ; LatticeVal for: '  %cont2 = icmp sgt i32 %iv2.next, 0' in BB: '%backedge' is: overdefined
 ; CHECK-NEXT:  %cont2 = icmp sgt i32 %iv2.next, 0
   %cont2 = icmp sgt i32 %iv2.next, 0
-; CHECK-NEXT:    ; LatticeVal for: '  %cont = and i1 %cont1, %cont2' in BB: '%backedge' is: constantrange<-1, -1>
+; CHECK-NEXT:    ; LatticeVal for: '  %cont = and i1 %cont1, %cont2' in BB: '%backedge' is: overdefined
 ; CHECK-NEXT:  %cont = and i1 %cont1, %cont2
   %cont = and i1 %cont1, %cont2
   br i1 %cont, label %loop, label %exit


        


More information about the llvm-commits mailing list