rust/src/librustc_codegen_llvm
bors 58b54911fa Auto merge of #59546 - sfanxiang:interminable-ub, r=nagisa
Add llvm.sideeffect to potential infinite loops and recursions

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

**UPDATE:** [Mentoring instructions here](https://github.com/rust-lang/rust/pull/59546#issuecomment-515072429) to unstall this PR
2019-10-10 15:40:39 +00:00
..
back Rollup merge of #65081 - Mark-Simulacrum:remove-profile-queries, r=michaelwoerister 2019-10-08 23:31:20 +02:00
debuginfo Rollup merge of #65124 - memoryruins:castaway, r=petrochenkov 2019-10-05 21:55:08 -07:00
llvm rustc_codegen_llvm: give names to non-alloca variable values. 2019-09-06 16:57:20 +03:00
abi.rs rustc: rely on c_variadic == true instead of CVarArgs in HIR/Ty fn signatures. 2019-09-28 17:39:00 +03:00
allocator.rs Replaces some instances of as *[const | mut] _ with .cast() 2019-10-05 03:48:14 -04:00
asm.rs Remove SyntaxContext from {ast, hir}::{GlobalAsm, InlineAsm} 2019-08-17 09:12:32 +01:00
attributes.rs Disable stack probe when thread sanitizer is enabled 2019-10-04 16:13:29 +02:00
base.rs Self-Profiling: Make names of existing events more consistent and use new API. 2019-09-30 13:31:56 +02:00
build.rs Remove licenses 2018-12-25 21:08:33 -07:00
builder.rs Rename some _sty variables to _kind 2019-09-26 12:10:43 +01:00
callee.rs Remove LocalInternedString uses from librustc/ty/. 2019-09-04 14:23:30 +10:00
Cargo.toml remove indexed_vec re-export from rustc_data_structures 2019-09-29 16:48:31 +00:00
common.rs Rollup merge of #64003 - Dante-Broggi:place-align-in-layout, r=matthewjasper 2019-09-05 12:11:08 +02:00
consts.rs Replaces some instances of as *[const | mut] _ with .cast() 2019-10-05 03:48:14 -04:00
context.rs Auto merge of #59546 - sfanxiang:interminable-ub, r=nagisa 2019-10-10 15:40:39 +00:00
declare.rs Pass type to byval attributes 2019-07-09 21:55:29 +02:00
error_codes.rs Replace diagnostic plugins with macro_rules 2019-09-05 12:35:15 -04:00
intrinsic.rs Generate llvm.sideeffect at function entry instead of call 2019-09-28 07:14:21 +08:00
lib.rs Rollup merge of #64840 - michaelwoerister:self-profiling-raii-refactor, r=wesleywiser 2019-10-01 23:06:16 -07:00
llvm_util.rs Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, r=alexcrichton" 2019-10-05 21:38:45 -07:00
metadata.rs format a bit 2019-07-07 09:32:36 +02:00
mono_item.rs remove reexport of rustc::ty::Instance 2019-06-02 22:32:42 -05:00
README.md rustc-guide has moved 2018-11-26 15:03:13 -06:00
type_.rs Remove lint annotations in specific crates that are already enforced by rustbuild 2019-07-28 18:46:24 +03:00
type_of.rs clean up GeneratorSubsts 2019-10-04 20:47:43 +08:00
va_arg.rs Expose VaListImpl as the Rust equivalent of __va_list_tag and implement Clone for it. 2019-06-17 16:04:49 -07:00
value.rs librustc_codegen_llvm: deny(elided_lifetimes_in_paths) 2019-02-25 08:40:18 +01:00

The codegen crate contains the code to convert from MIR into LLVM IR, and then from LLVM IR into machine code. In general it contains code that runs towards the end of the compilation process.

For more information about how codegen works, see the rustc guide.