Remove some minor checks for LLVM < 12
This commit is contained in:
parent
d22dd65835
commit
1d04577ee0
@ -1,7 +1,6 @@
|
|||||||
use crate::builder::Builder;
|
use crate::builder::Builder;
|
||||||
use crate::context::CodegenCx;
|
use crate::context::CodegenCx;
|
||||||
use crate::llvm::{self, AttributePlace};
|
use crate::llvm::{self, AttributePlace};
|
||||||
use crate::llvm_util;
|
|
||||||
use crate::type_::Type;
|
use crate::type_::Type;
|
||||||
use crate::type_of::LayoutLlvmExt;
|
use crate::type_of::LayoutLlvmExt;
|
||||||
use crate::value::Value;
|
use crate::value::Value;
|
||||||
@ -53,15 +52,10 @@ fn apply_attrs_to_callsite(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn should_use_mutable_noalias(cx: &CodegenCx<'_, '_>) -> bool {
|
fn should_use_mutable_noalias(cx: &CodegenCx<'_, '_>) -> bool {
|
||||||
// LLVM prior to version 12 has known miscompiles in the presence of
|
// LLVM prior to version 12 had known miscompiles in the presence of
|
||||||
// noalias attributes (see #54878). Only enable mutable noalias by
|
// noalias attributes (see #54878), but we don't support earlier
|
||||||
// default for versions we believe to be safe.
|
// versions at all anymore. We now enable mutable noalias by default.
|
||||||
cx.tcx
|
cx.tcx.sess.opts.debugging_opts.mutable_noalias.unwrap_or(true)
|
||||||
.sess
|
|
||||||
.opts
|
|
||||||
.debugging_opts
|
|
||||||
.mutable_noalias
|
|
||||||
.unwrap_or_else(|| llvm_util::get_version() >= (12, 0, 0))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ArgAttributesExt for ArgAttributes {
|
impl ArgAttributesExt for ArgAttributes {
|
||||||
|
@ -731,7 +731,7 @@ fn sext(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn fptoui_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
|
fn fptoui_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
|
||||||
if llvm_util::get_version() >= (12, 0, 0) && !self.fptoint_sat_broken_in_llvm() {
|
if !self.fptoint_sat_broken_in_llvm() {
|
||||||
let src_ty = self.cx.val_ty(val);
|
let src_ty = self.cx.val_ty(val);
|
||||||
let float_width = self.cx.float_width(src_ty);
|
let float_width = self.cx.float_width(src_ty);
|
||||||
let int_width = self.cx.int_width(dest_ty);
|
let int_width = self.cx.int_width(dest_ty);
|
||||||
@ -743,7 +743,7 @@ fn fptoui_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Val
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn fptosi_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
|
fn fptosi_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
|
||||||
if llvm_util::get_version() >= (12, 0, 0) && !self.fptoint_sat_broken_in_llvm() {
|
if !self.fptoint_sat_broken_in_llvm() {
|
||||||
let src_ty = self.cx.val_ty(val);
|
let src_ty = self.cx.val_ty(val);
|
||||||
let float_width = self.cx.float_width(src_ty);
|
let float_width = self.cx.float_width(src_ty);
|
||||||
let int_width = self.cx.int_width(dest_ty);
|
let int_width = self.cx.int_width(dest_ty);
|
||||||
|
@ -134,9 +134,6 @@ pub unsafe fn create_module(
|
|||||||
let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx);
|
let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx);
|
||||||
|
|
||||||
let mut target_data_layout = sess.target.data_layout.clone();
|
let mut target_data_layout = sess.target.data_layout.clone();
|
||||||
if llvm_util::get_version() < (12, 0, 0) && sess.target.arch == "powerpc64" {
|
|
||||||
target_data_layout = target_data_layout.replace("-v256:256:256-v512:512:512", "");
|
|
||||||
}
|
|
||||||
if llvm_util::get_version() < (13, 0, 0) {
|
if llvm_util::get_version() < (13, 0, 0) {
|
||||||
if sess.target.arch == "powerpc64" {
|
if sess.target.arch == "powerpc64" {
|
||||||
target_data_layout = target_data_layout.replace("-S128", "");
|
target_data_layout = target_data_layout.replace("-S128", "");
|
||||||
|
Loading…
Reference in New Issue
Block a user