[PATCH] D62544: [InstCombine] Optimize always overflowing signed saturating add/sub

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 09:30:04 PDT 2019


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:2074
+        unsigned BitWidth = Ty->getScalarSizeInBits();
+        APInt Min = APSInt::getMinValue(BitWidth, !SI->isSigned());
+        return replaceInstUsesWith(*SI, ConstantInt::get(Ty, Min));
----------------
craig.topper wrote:
> What's really happening on this line? APSInt::getMinValue returns an APSInt object which is larger than an APInt object. Does this create an APSInt and then copy the APInt part of that out into a separate APInt? Or does the APInt portion get moved?
https://godbolt.org/z/kNAaNg


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

https://reviews.llvm.org/D62544





More information about the llvm-commits mailing list