LLVM assumes that a thread will eventually cause side effect. This is
not true in Rust if a loop or recursion does nothing in its body,
causing undefined behavior even in common cases like `loop {}`.
Inserting llvm.sideeffect fixes the undefined behavior.
As a micro-optimization, only insert llvm.sideeffect when jumping back
in blocks or calling a function.
A patch for LLVM is expected to allow empty non-terminate code by
default and fix this issue from LLVM side.
https://github.com/rust-lang/rust/issues/28728
|
||
|---|---|---|
| .. | ||
| abi.rs | ||
| asm.rs | ||
| backend.rs | ||
| builder.rs | ||
| consts.rs | ||
| debuginfo.rs | ||
| declare.rs | ||
| intrinsic.rs | ||
| misc.rs | ||
| mod.rs | ||
| statics.rs | ||
| type_.rs | ||
| write.rs | ||