Change checkRippleForAdd from a heuristic to a full check -
if it is provable that the add does not overflow return true, otherwise false.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Transforms/InstCombine/InstCombineAddSub.cpp | ||
---|---|---|
866 ↗ | (On Diff #97237) | Space between 'if' and 'parenthese' |
871 ↗ | (On Diff #97237) | Wrap both MaxLHS and MaxRHS in std::move so we can reuse one of their allocations to hold the addition result when dealing with larger than 64-bit numbers. |
880 ↗ | (On Diff #97237) | Space between 'if' and 'parenthese' |
885 ↗ | (On Diff #97237) | Wrap both MinLHS and MinRHS in std::move so we can reuse one of their allocations to hold the addition result when dealing with larger than 64-bit numbers. |
lib/Transforms/InstCombine/InstCombineAddSub.cpp | ||
---|---|---|
853 ↗ | (On Diff #97237) | The these parameter names are swapped relative to the caller. Prefer LHS followed by RHS. |
866 ↗ | (On Diff #97237) | Also do LHS check first then RHS. Basically as much as possible do everything for LHS before RHS. |
871 ↗ | (On Diff #97237) | Or better yet, maybe just use MaxLHS += MaxRHS. |
Thanks for the comments, fixed.
I opted for std::move and not += because both don't allocate,
and std::move looks more readable (dedicated name 'Result').
Let me know what you think.