Based on the overflow direction information added in D62463, we can now fold always overflowing signed saturating add/sub to signed min/max.
Details
Diff Detail
Event Timeline
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
2074–2075 | It works, but I'm wondering whether it's okay to use APSInt for this purpose. It looks like APSInt is used heavily by clang, but the only uses in the LLVM middle end are for interfacing with the convertToInteger() APFloat API. |
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
2074–2075 | If it's not ok to use it for this purpose then i, too, would like to know about that :) |
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
2074 | 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? |
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
2074 | My C++ foo is pretty weak, so I stepped through this in gdb... It takes the APInt(APInt &&) move constructor. |
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
2074 |
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?