diff options
| author | Simonas Kazlauskas <git@kazlauskas.me> | 2021-03-08 01:59:10 +0200 |
|---|---|---|
| committer | Simonas Kazlauskas <git@kazlauskas.me> | 2021-03-10 12:21:43 +0200 |
| commit | 0517acd54353869b2fbfc50af61ea7bd1fd309e0 (patch) | |
| tree | a3670ca840e1c6def8f4be36a7419f2682488863 /compiler/rustc_codegen_llvm/src | |
| parent | 861872bc453bde79b83ff99d443d035225f10e87 (diff) | |
| download | rust-0517acd54353869b2fbfc50af61ea7bd1fd309e0.tar.gz rust-0517acd54353869b2fbfc50af61ea7bd1fd309e0.zip | |
Remove the -Zinsert-sideeffect
This removes all of the code we had in place to work-around LLVM's
handling of forward progress. From this removal excluded is a workaround
where we'd insert a `sideeffect` into clearly infinite loops such as
`loop {}`. This code remains conditionally effective when the LLVM
version is earlier than 12.0, which fixed the forward progress related
miscompilations at their root.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/intrinsic.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 668daa52ed2..f445d708c94 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -334,8 +334,11 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { self.call(expect, &[cond, self.const_bool(expected)], None) } - fn sideeffect(&mut self, unconditional: bool) { - if unconditional || self.tcx.sess.opts.debugging_opts.insert_sideeffect { + fn sideeffect(&mut self) { + // This kind of check would make a ton of sense in the caller, but currently the only + // caller of this function is in `rustc_codegen_ssa`, which is agnostic to whether LLVM + // codegen backend being used, and so is unable to check the LLVM version. + if unsafe { llvm::LLVMRustVersionMajor() } < 12 { let fnname = self.get_intrinsic(&("llvm.sideeffect")); self.call(fnname, &[], None); } @@ -390,7 +393,6 @@ fn codegen_msvc_try( ) { let llfn = get_rust_try_fn(bx, &mut |mut bx| { bx.set_personality_fn(bx.eh_personality()); - bx.sideeffect(false); let mut normal = bx.build_sibling_block("normal"); let mut catchswitch = bx.build_sibling_block("catchswitch"); @@ -552,9 +554,6 @@ fn codegen_gnu_try( // (%ptr, _) = landingpad // call %catch_func(%data, %ptr) // ret 1 - - bx.sideeffect(false); - let mut then = bx.build_sibling_block("then"); let mut catch = bx.build_sibling_block("catch"); @@ -614,9 +613,6 @@ fn codegen_emcc_try( // %catch_data[1] = %is_rust_panic // call %catch_func(%data, %catch_data) // ret 1 - - bx.sideeffect(false); - let mut then = bx.build_sibling_block("then"); let mut catch = bx.build_sibling_block("catch"); |
