[PATCH] D60420: [ValueTracking] Use computeConstantRange() for signed add overflow determination

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 9 00:34:31 PDT 2019


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4136-4159
+  ConstantRange LHSRange = computeConstantRangeIncludingKnownBits(
+      LHS, /*ForSigned=*/true, DL, /*Depth=*/0, AC, CxtI, DT);
+  ConstantRange RHSRange = computeConstantRangeIncludingKnownBits(
+      RHS, /*ForSigned=*/true, DL, /*Depth=*/0, AC, CxtI, DT);
   OverflowResult OR =
       mapOverflowResult(LHSRange.signedAddMayOverflow(RHSRange));
   if (OR != OverflowResult::MayOverflow)
----------------
nikic wrote:
> lebedev.ri wrote:
> > This looks like it should be a new differential, after the this one.
> This change is needed because the LHSKnown variable no longer exists, so it can't come after. There's no reason it can't come before though, so done in rL357969.
Sure. But i was talking about the entire block of code i highlighted with a comment.
I.e. i think the rest of the `computeOverflowForSignedAdd()` change should be in a new diff too.
Or if you leave just the `computeConstantRangeIncludingKnownBits()` part, there are no test changes?


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

https://reviews.llvm.org/D60420





More information about the llvm-commits mailing list