
ConstantRange's constructor asserts that the range not empty, except if lower/upper are min or max values. Check if the length is strictly positive instead of just non-negative so std::nullopt is returned when the size is 0. If that's the case, the access doesn't initialize anything. This should fix a crash when building on macOS with ASan & UBsan after https://github.com/llvm/llvm-project/pull/97373 / https://github.com/llvm/llvm-project/pull/117104 landed: https://green.lab.llvm.org/job/llvm.org/job/clang-stage2-cmake-RgSan/664/console