[PATCH] D23194: [LVI] Relax the assertion about LVILatticeVal type in getConstantRange

Artur Pilipenko via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 05:00:46 PDT 2016


apilipenko updated this revision to Diff 66929.
apilipenko added a comment.

Upload the diff with full context.


https://reviews.llvm.org/D23194

Files:
  lib/Analysis/LazyValueInfo.cpp

Index: lib/Analysis/LazyValueInfo.cpp
===================================================================
--- lib/Analysis/LazyValueInfo.cpp
+++ lib/Analysis/LazyValueInfo.cpp
@@ -1516,11 +1516,15 @@
   const DataLayout &DL = BB->getModule()->getDataLayout();
   LVILatticeVal Result =
       getCache(PImpl, AC, &DL, DT).getValueInBlock(V, BB, CxtI);
-  assert(!Result.isConstant());
   if (Result.isUndefined())
     return ConstantRange(Width, /*isFullSet=*/false);
   if (Result.isConstantRange())
     return Result.getConstantRange();
+  if (Result.isConstant())
+    // We represent ConstantInt constants as constant ranges but other kinds
+    // of integer constants, i.e. ConstantExpr will be tagged as constants
+    assert(!isa<ConstantInt>(Result.getConstant()) &&
+           "ConstantInt value must be represented as constantrange");
   return ConstantRange(Width, /*isFullSet=*/true);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23194.66929.patch
Type: text/x-patch
Size: 906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160805/0d8afec2/attachment.bin>


More information about the llvm-commits mailing list