refactor check_{lang,library}_ub: use a single intrinsic, put policy into library

This commit is contained in:
Ralf Jung 2024-03-17 10:29:02 +01:00
parent 987ef4c922
commit 6177530420
34 changed files with 133 additions and 118 deletions

View file

@ -680,8 +680,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let val = layout.offset_of_subfield(bx.cx(), fields.iter()).bytes();
bx.cx().const_usize(val)
}
mir::NullOp::UbCheck(_) => {
// In codegen, we want to check for language UB and library UB
mir::NullOp::UbChecks => {
let val = bx.tcx().sess.opts.debug_assertions;
bx.cx().const_bool(val)
}