Implement `black_box` using intrinsic

The new implementation allows some `memcpy`s to be optimized away,
so the uninit value in ui/sanitize/memory.rs is constructed directly
onto the return place. Therefore the sanitizer now says that the
value is allocated by `main` rather than `random`.
This commit is contained in:
Gary Guo 2021-08-10 11:50:33 +01:00
parent d220159810
commit 74b17685fe
1 changed files with 5 additions and 0 deletions

View File

@ -1136,6 +1136,11 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
};
ret.write_cvalue(fx, CValue::by_val(is_eq_value, ret.layout()));
};
black_box, (c a) {
// FIXME implement black_box semantics
ret.write_cvalue(fx, a);
};
}
if let Some((_, dest)) = destination {