Skip to content

Commit e27588a

Browse files
authored
Rollup merge of rust-lang#90900 - andjo403:removeLlvm12Check, r=nikic
Remove workaround for the forward progress handling in LLVM this workaround was only needed for LLVM < 12 and the minimum LLVM version was updated to 12 in rust-lang#90175
2 parents 09743d2 + 50ec47a commit e27588a

File tree

5 files changed

+1
-30
lines changed

5 files changed

+1
-30
lines changed

compiler/rustc_codegen_gcc/src/intrinsic/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
316316
extended_asm.add_input_operand(None, "r", result.llval);
317317
extended_asm.add_clobber("memory");
318318
extended_asm.set_volatile_flag(true);
319-
319+
320320
// We have copied the value to `result` already.
321321
return;
322322
}
@@ -363,10 +363,6 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
363363
cond
364364
}
365365

366-
fn sideeffect(&mut self) {
367-
// TODO(antoyo)
368-
}
369-
370366
fn type_test(&mut self, _pointer: Self::Value, _typeid: Self::Value) -> Self::Value {
371367
// Unsupported.
372368
self.context.new_rvalue_from_int(self.int_type, 0)

compiler/rustc_codegen_llvm/src/context.rs

-1
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,6 @@ impl CodegenCx<'b, 'tcx> {
597597
ifn!("llvm.trap", fn() -> void);
598598
ifn!("llvm.debugtrap", fn() -> void);
599599
ifn!("llvm.frameaddress", fn(t_i32) -> i8p);
600-
ifn!("llvm.sideeffect", fn() -> void);
601600

602601
ifn!("llvm.powi.f32", fn(t_f32, t_i32) -> t_f32);
603602
ifn!("llvm.powi.f64", fn(t_f64, t_i32) -> t_f64);

compiler/rustc_codegen_llvm/src/intrinsic.rs

-9
Original file line numberDiff line numberDiff line change
@@ -392,15 +392,6 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
392392
self.call_intrinsic("llvm.expect.i1", &[cond, self.const_bool(expected)])
393393
}
394394

395-
fn sideeffect(&mut self) {
396-
// This kind of check would make a ton of sense in the caller, but currently the only
397-
// caller of this function is in `rustc_codegen_ssa`, which is agnostic to whether LLVM
398-
// codegen backend being used, and so is unable to check the LLVM version.
399-
if unsafe { llvm::LLVMRustVersionMajor() } < 12 {
400-
self.call_intrinsic("llvm.sideeffect", &[]);
401-
}
402-
}
403-
404395
fn type_test(&mut self, pointer: Self::Value, typeid: Self::Value) -> Self::Value {
405396
// Test the called operand using llvm.type.test intrinsic. The LowerTypeTests link-time
406397
// optimization pass replaces calls to this intrinsic with code to test type membership.

compiler/rustc_codegen_ssa/src/mir/block.rs

-11
Original file line numberDiff line numberDiff line change
@@ -980,17 +980,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
980980
}
981981

982982
mir::TerminatorKind::Goto { target } => {
983-
if bb == target {
984-
// This is an unconditional branch back to this same basic block. That means we
985-
// have something like a `loop {}` statement. LLVM versions before 12.0
986-
// miscompile this because they assume forward progress. For older versions
987-
// try to handle just this specific case which comes up commonly in practice
988-
// (e.g., in embedded code).
989-
//
990-
// NB: the `sideeffect` currently checks for the LLVM version used internally.
991-
bx.sideeffect();
992-
}
993-
994983
helper.funclet_br(self, &mut bx, target);
995984
}
996985

compiler/rustc_codegen_ssa/src/traits/intrinsic.rs

-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ pub trait IntrinsicCallMethods<'tcx>: BackendTypes {
2020
fn abort(&mut self);
2121
fn assume(&mut self, val: Self::Value);
2222
fn expect(&mut self, cond: Self::Value, expected: bool) -> Self::Value;
23-
/// Emits a forced side effect.
24-
///
25-
/// Currently has any effect only when LLVM versions prior to 12.0 are used as the backend.
26-
fn sideeffect(&mut self);
2723
/// Trait method used to test whether a given pointer is associated with a type identifier.
2824
fn type_test(&mut self, pointer: Self::Value, typeid: Self::Value) -> Self::Value;
2925
/// Trait method used to inject `va_start` on the "spoofed" `VaListImpl` in

0 commit comments

Comments
 (0)