[PATCH] D19559: [LVI] Exploit trivial range information from unknown RHS of icmp

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 23:51:39 PDT 2016


sanjoy requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: lib/Analysis/LazyValueInfo.cpp:1162
@@ +1161,3 @@
+    // A <u B for any A and B implies A <u UINT_MAX on success path
+    if ((ICI->getPredicate() == ICmpInst::ICMP_SLT ||
+         ICI->getPredicate() == ICmpInst::ICMP_ULT)) {
----------------
I wouldn't put all this logic here. Instead, it is easier to do:

```
ConstantRange RHSRange = FullRange;
ConstantRange LHSRange = makeAllowedRange(ICI->getPredicate(), RHSRange);
if (LHSRange is not full set)
  Result = LVILatticeVal::getRange(LHSRange);
```

Later you can improve precision by making `RHSRange` more precise.


http://reviews.llvm.org/D19559





More information about the llvm-commits mailing list