[PATCH] D79234: [ValueTracking] Fix computeKnownBits() with bitwidth-changing ptrtoint

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 15 15:14:33 PDT 2020


efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: lib/Analysis/ValueTracking.cpp:794
+        KnownBits RHSKnown =
+            computeKnownBits(A, Depth+1, Query(Q, I)).anyextOrTrunc(BitWidth);
         Known.Zero |= RHSKnown.Zero;
----------------
nikic wrote:
> efriedma wrote:
> > LangRef says ptrtoint zero-extends.
> Here we have the knownbits of the ptrtoint result and want to reason backwards to the knownbits of the ptrtoint operand. If the ptrtoint zexted, that means we need to trunc. If the ptrtoint truncated, that means we need to anyext.
> 
> Here anyextOrTrunc is used as the inverse operation to zextOrTrunc.
Oh, right.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79234





More information about the llvm-commits mailing list