When compiling compiler-rt with -fsanitize=undefined and running testcases you
end up with the following warning:
UBSan:/repo/uabkaka/llvm-project/compiler-rt/lib/builtins/int_mulo_impl.inc:24:23: signed integer overflow: -1 * -2147483648 cannot be represented in type 'si_int' (aka 'long')
This can be avoided by doing the multiplication in a matching unsigned variant
of the type.
This was found in an out of tree target.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D146623
When compiling compiler-rt with -fsanitize=undefined and running testcases you
end up with the following warning:
UBSan: int_mulo_impl.inc:21:36: left shift of 1 by 63 places cannot be represented in type 'di_int' (aka 'long long')
This can be avoided by simply doing the shift in a matching unsigned variant of
the type.
The same kind of pattern seems to exist in int_mulv_impl.inc
This was found in an out of tree target.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D145556
The existing implementations are almost identical except for width of the
integer type.
Factor them out to int_mulo_impl.inc for better maintainability.
This patch is almost identical to D86277.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D86289