Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1d04577

Browse files
committed
Remove some minor checks for LLVM < 12
1 parent d22dd65 commit 1d04577

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::builder::Builder;
22
use crate::context::CodegenCx;
33
use crate::llvm::{self, AttributePlace};
4-
use crate::llvm_util;
54
use crate::type_::Type;
65
use crate::type_of::LayoutLlvmExt;
76
use crate::value::Value;
@@ -53,15 +52,10 @@ pub trait ArgAttributesExt {
5352
}
5453

5554
fn should_use_mutable_noalias(cx: &CodegenCx<'_, '_>) -> bool {
56-
// LLVM prior to version 12 has known miscompiles in the presence of
57-
// noalias attributes (see #54878). Only enable mutable noalias by
58-
// default for versions we believe to be safe.
59-
cx.tcx
60-
.sess
61-
.opts
62-
.debugging_opts
63-
.mutable_noalias
64-
.unwrap_or_else(|| llvm_util::get_version() >= (12, 0, 0))
55+
// LLVM prior to version 12 had known miscompiles in the presence of
56+
// noalias attributes (see #54878), but we don't support earlier
57+
// versions at all anymore. We now enable mutable noalias by default.
58+
cx.tcx.sess.opts.debugging_opts.mutable_noalias.unwrap_or(true)
6559
}
6660

6761
impl ArgAttributesExt for ArgAttributes {

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
731731
}
732732

733733
fn fptoui_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
734-
if llvm_util::get_version() >= (12, 0, 0) && !self.fptoint_sat_broken_in_llvm() {
734+
if !self.fptoint_sat_broken_in_llvm() {
735735
let src_ty = self.cx.val_ty(val);
736736
let float_width = self.cx.float_width(src_ty);
737737
let int_width = self.cx.int_width(dest_ty);
@@ -743,7 +743,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
743743
}
744744

745745
fn fptosi_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
746-
if llvm_util::get_version() >= (12, 0, 0) && !self.fptoint_sat_broken_in_llvm() {
746+
if !self.fptoint_sat_broken_in_llvm() {
747747
let src_ty = self.cx.val_ty(val);
748748
let float_width = self.cx.float_width(src_ty);
749749
let int_width = self.cx.int_width(dest_ty);

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ pub unsafe fn create_module(
134134
let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx);
135135

136136
let mut target_data_layout = sess.target.data_layout.clone();
137-
if llvm_util::get_version() < (12, 0, 0) && sess.target.arch == "powerpc64" {
138-
target_data_layout = target_data_layout.replace("-v256:256:256-v512:512:512", "");
139-
}
140137
if llvm_util::get_version() < (13, 0, 0) {
141138
if sess.target.arch == "powerpc64" {
142139
target_data_layout = target_data_layout.replace("-S128", "");

0 commit comments

Comments
 (0)