[PATCH] D62544: [InstCombine] Optimize always overflowing signed saturating add/sub
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 29 09:30:03 PDT 2019
nikic marked an inline comment as done.
nikic 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));
----------------
lebedev.ri wrote:
> 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
My C++ foo is pretty weak, so I stepped through this in gdb... It takes the `APInt(APInt &&)` move constructor.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62544/new/
https://reviews.llvm.org/D62544
More information about the llvm-commits
mailing list