================ @@ -1986,10 +2013,15 @@ bool CodeGenFunction::EmitScalarRangeCheck(llvm::Value *Value, QualType Ty, getContext().isTypeIgnoredBySanitizer(SanitizerKind::Enum, Ty)) return false; - llvm::APInt Min, End; - if (!getRangeForType(*this, Ty, Min, End, /*StrictEnums=*/true, IsBool)) + const std::optional<llvm::ConstantRange> Range = getRangeForType( + Ty, getContext().getTypeSize(Ty), /*ForceStrictEnums=*/true, + /*AssumeBooleanRepresentation*/ IsBool); ---------------- keinflue wrote:
`AssumeBooleanRepresentation` is used here because of `|| NSAPI(CGM.getContext()).isObjCBOOLType(Ty)` in `IsBool` above. This condition was not present in the use of `getRangeForType` for load optimization purposes and I do not know why it is special cased like this for the sanitizer. https://github.com/llvm/llvm-project/pull/154807 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits