[llvm] [CVP] Propagate constant range on icmp at use level (PR #73767)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 22:03:23 PST 2023


================
@@ -1932,6 +1932,32 @@ LazyValueInfo::Tristate LazyValueInfo::getPredicateAt(unsigned P, Value *LHS,
   return LazyValueInfo::Unknown;
 }
 
+LazyValueInfo::Tristate
+LazyValueInfo::getPredicateAtUse(unsigned P, const Use &LHS, const Use &RHS) {
+  const Instruction *CxtI = dyn_cast<Instruction>(LHS.getUser());
+
+  if (!CxtI)
+    return LazyValueInfo::Unknown;
----------------
dtcxzyw wrote:

```suggestion
  const Instruction *CxtI = cast<Instruction>(LHS.getUser());
```
The cast should never fail.


https://github.com/llvm/llvm-project/pull/73767


More information about the llvm-commits mailing list