[llvm] [ValueTracking] Handle trunc to i1 as condition in dominating condition. (PR #126414)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 9 06:07:52 PST 2025


================
@@ -801,6 +801,22 @@ static void computeKnownBitsFromCond(const Value *V, Value *Cond,
 
   if (auto *Cmp = dyn_cast<ICmpInst>(Cond))
     computeKnownBitsFromICmpCond(V, Cmp, Known, SQ, Invert);
+
+  if (match(Cond, m_Not(m_Value(Cond))))
+    Invert = !Invert;
----------------
nikic wrote:

Can you please split this off into a followup change? I think it makes sense to handle it, but if we do so, we should do it generically, not for trunc conditions in particular.

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


More information about the llvm-commits mailing list