This patch incapsulates some commonly used hacks in a (hopefully) UB-free manner.
Some existing LibCall implementations contain constants like this one:
const di_int MIN = (di_int)1 << ((int)(sizeof(di_int) * CHAR_BIT) - 1);
UBSan complains on such expressions and that seems to be true positive.
This patch is expected to be NFC except for eliminating some UB. It consists of the following parts:
- implementing helpers in int_types.h
- replacing some typedefs with #defines so these type alises can be handled by the above machinery
- replacing some constants with these common helper invocations
- this is expected to be unable to cause any performance regressions as these are actually compile-time constants
- fixing a couple of UBs in __neg?i2 LibCalls
AFAIK LLVM_USE_SANITIZER does not instrument compiler-rt. libclang_rt.builtins- is at the bottom of the library layering. How did you enable sanitizers?