Skip to content

Commit 412ed92

Browse files
committed
Auto merge of #87916 - nbdd0121:black_box, r=nagisa
Implement `black_box` using intrinsic Introduce `black_box` intrinsic, as suggested in rust-lang/rust#87590 (comment). This is still codegenned as empty inline assembly for LLVM. For MIR interpretation and cranelift it's treated as identity. cc `@Amanieu` as this is related to inline assembly cc `@bjorn3` for rustc_codegen_cranelift changes cc `@RalfJung` as this affects MIRI r? `@nagisa` I suppose
2 parents 7551dd2 + 12c3298 commit 412ed92

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/intrinsics/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,11 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
11361136
};
11371137
ret.write_cvalue(fx, CValue::by_val(is_eq_value, ret.layout()));
11381138
};
1139+
1140+
black_box, (c a) {
1141+
// FIXME implement black_box semantics
1142+
ret.write_cvalue(fx, a);
1143+
};
11391144
}
11401145

11411146
if let Some((_, dest)) = destination {

0 commit comments

Comments
 (0)