UBSan can check that scalar loads provide in-range values. When we load
a value from a bitfield, we know that the range of the value is
constrained by the bitfield's width. This patch teaches UBSan how to use
that information to skip emitting some range checks.
This depends on / is a follow-up to: https://reviews.llvm.org/D30423
Add checks/check-nots to make sure the thing you don't want isn't emitted, not just !nosanitize
The checks help document what you're trying to get in each test case.
Here I'd prefer to have a CHECK-NOT: __ubsan_handle_load_invalid_value than a check-not for !nosanitize, since checking for the handler call is more explicit.