about summary refs log tree commit diff
path: root/src/test/codegen/non-terminate
AgeCommit message (Collapse)AuthorLines
2019-09-28Gate llvm.sideeffect under -Z insert-sideeffectXiang Fan-3/+3
2019-09-28Add llvm.sideeffect to potential infinite loops and recursionsXiang Fan-0/+50
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