[llvm] [ValueTracking] Handle `icmp pred (trunc X), C` in `computeKnownBitsFromCmp` (PR #82803)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 12:04:24 PST 2024


================
@@ -27,7 +27,8 @@ static void findAffectedValues(Value *Cond,
 
       // Peek through unary operators to find the source of the condition.
       Value *Op;
-      if (match(I, m_PtrToInt(m_Value(Op)))) {
+      if (match(I,
+                m_CombineOr(m_PtrToInt(m_Value(Op)), m_Trunc(m_Value(Op))))) {
----------------
nikic wrote:

Can you please also add a test using assume? I think to make it work you need to move the logic from computeKnownBitsFromCond into computeKnownBitsFromCmp.

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


More information about the llvm-commits mailing list