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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 13:05:41 PDT 2020


nikic added a comment.

Here are the results for the new version: http://llvm-compile-time-tracker.com/compare.php?from=188f1ac301c5c6da6d2f5697952510fc39cbdd43&to=a43ce9e792896679e71314fc368a027a2c9ae544&stat=instructions

This is better than before, but still quite expensive for what it does.



================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:1506
+        if (IndexTypeSize.isScalable())
+          AddrKnownBits.resetAll();
+        if (!AddrKnownBits.isUnknown()) {
----------------
qcolombet wrote:
> @nikic FYI here is where we stop to track the full address but we still compute the trailing zeros.
> 
> If we don't do that, we will lose some information compared to the previous implementation.
> E.g., test/Analysis/ScalarEvolution/scalable-vector.ll will fail
> :5:10: error: CHECK: expected string not found in input
> ; CHECK: --> (3 * sizeof(<vscale x 4 x i32>)) U: [0,-15) S: [-9223372036854775808,9223372036854775793)
>          ^
> <stdin>:4:2: note: scanning from here
>  --> (3 * sizeof(<vscale x 4 x i32>)) U: full-set S: full-set
Okay, I see. I think we should still be able to combine these with some special handling in this spot. Would something like this work?

 * Combine IndexBits using computeKnownBitsMul as usual.
 * For scalable vectors, the result is additionally multiplied by an unknown vscale. As an approximation, only keep the trailing zero bits of IndexBits in this case, and then continue as usual.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:1527
+      else if (IndexBitWidth > BitWidth)
+        IndexBits = IndexBits.trunc(BitWidth);
+
----------------
We should add an sextOrTrunc() method to KnownBits. We already have zextOrTrunc() and anyextOrTrunc().


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86364



More information about the llvm-commits mailing list