[PATCH] D86364: [ValueTracking] Interpret GEPs as a series of adds multiplied by the related scaling factor

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 12:36:09 PDT 2020


qcolombet created this revision.
qcolombet added reviewers: fhahn, nikic, aqjune.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
qcolombet requested review of this revision.

Prior to this patch, computeKnownBits would only try to deduce trailing zeros bits for getelementptrs.
This patch adds the logic to treat geps as a series of add * scaling factor.

To do so, we refactored the logic in computeKnownBitsMul to expose an API that works on a pair of KnownBits. Then, we used it in conjunction of computeKnownBitsAddSub to compute the series of adds * mul when processing geps.

Thanks to this patch, using a gep or performing an address computation directly "by hand" (ptrtoint followed by adds and mul followed by inttoptr) is going to offer the same computeKnownBits information.

Previously, the "by hand" approach would have given more information.

This is related to https://llvm.org/PR47241.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86364

Files:
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/unittests/Analysis/ValueTrackingTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86364.287082.patch
Type: text/x-patch
Size: 14274 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200821/48eccbdf/attachment.bin>


More information about the llvm-commits mailing list