[PATCH] D73435: [ValueTracking] Add DemandedElts support to computeKnownBits/ComputeNumSignBits (PR36319)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 11:12:35 PST 2020


RKSimon marked an inline comment as done.
RKSimon added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:1748-1749
+    Known.Zero.setAllBits();
+    if (DemandedVal)
+      computeKnownBits(Elt, Known, Depth + 1, Q);
+    // If we don't know any bits, early out.
----------------
lebedev.ri wrote:
> If `Idx` is not a constant, or out-of-bounds, why do we still `computeKnownBits()` of `Elt`?
> If `Idx` is in-bounds constant, why do we call `computeKnownBits()` only on `Elt`?
> 
> If Idx is not a constant, or out-of-bounds, why do we still computeKnownBits() of Elt?

OK, I'll change this to early out.

> If Idx is in-bounds constant, why do we call computeKnownBits() only on Elt?

We don't - as long as its demanded (DemandedVal == true) we check Elt first, early out if we don't know anything, and then check the base vector as well (if it has any remaining demanded elts) and merge the common known bits.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73435





More information about the llvm-commits mailing list