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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 09:17:01 PDT 2019


craig.topper 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));
----------------
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?


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

https://reviews.llvm.org/D62544





More information about the llvm-commits mailing list