[PATCH] D59473: [ValueTracking] Avoid redundant known bits calculation in computeOverflowForSignedAdd()

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 17 14:42:26 PDT 2019


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


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4192-4194
+    KnownBits AddKnown(LHSKnown.getBitWidth());
+    computeKnownBitsFromAssume(
+        Add, AddKnown, /*Depth=*/0, Query(DL, AC, CxtI, DT, true));
----------------
lebedev.ri wrote:
> What about this comment in `computeKnownBits()`:
> ```
>   // computeKnownBitsFromAssume strictly refines Known.
>   // Therefore, we run them after computeKnownBitsFromOperator.
> ```
> By looking at `computeKnownBitsFromAssume()`, it doesn't look like that will affect the correctness of output,
> the bits that weren't inferred from assumption will simply remain unknown, correct?
That's right. computeKnownBitsFromAssume() ORs in any additional known bits it can determine. With the `computeKnownBits()` call it would start off from the `computeKnownBitsFromOperator()` bits, while with the direct call here it will start off with no known bits.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D59473





More information about the llvm-commits mailing list