[PATCH] D152838: [ValueTracking] Add range computation from dominating conditions

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 13:26:43 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:6061
+    if (LHS == V && match(RHS, m_APInt(C)))
+      if (C->getBitWidth() == BitWidth)
+        return ConstantRange::makeExactICmpRegion(Pred, *C);
----------------
goldstein.w.n wrote:
> All of the above can be:
> ```
> CmpInst::Predicate Pred;
> const APInt * C;
> if(match(Condition, m_c_ICmp(Pred, m_Specific(V), m_APInt(C))) && C->getBitWidth() == BitWidth)
>    return ConstantRange::makeExactICmpRegion(Pred, *C);
> ```
`m_c_ICmp` is also probably not needed b.c we cannoniclize constants to the RHS.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152838/new/

https://reviews.llvm.org/D152838



More information about the llvm-commits mailing list