1
Fork 0

Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, r=alexcrichton"

This reverts commit 7870050796, reversing
changes made to 2e7244807a.
This commit is contained in:
Tyler Mandry 2019-10-05 21:38:45 -07:00
parent 7870050796
commit d16b7f705b
142 changed files with 537 additions and 377 deletions

View file

@ -114,8 +114,24 @@ pub fn black_box<T>(dummy: T) -> T {
// this. LLVM's intepretation of inline assembly is that it's, well, a black
// box. This isn't the greatest implementation since it probably deoptimizes
// more than we want, but it's so far good enough.
#[cfg(not(any(
target_arch = "asmjs",
all(
target_arch = "wasm32",
target_os = "emscripten"
)
)))]
unsafe {
asm!("" : : "r"(&dummy));
return dummy;
}
// Not all platforms support inline assembly so try to do something without
// inline assembly which in theory still hinders at least some optimizations
// on those targets. This is the "best effort" scenario.
unsafe {
let ret = crate::ptr::read_volatile(&dummy);
crate::mem::forget(dummy);
ret
}
}