From fea51f391ed91c487dda81d50389474b768441c7 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Wed, 29 Jun 2022 21:31:02 -0400 Subject: [PATCH] Fix warnings --- src/attributes.rs | 6 +++++- src/base.rs | 14 -------------- src/intrinsic/llvm.rs | 2 +- src/intrinsic/simd.rs | 4 +++- src/lib.rs | 18 ------------------ 5 files changed, 9 insertions(+), 35 deletions(-) diff --git a/src/attributes.rs b/src/attributes.rs index c52b10ee20a8..c9ba0ecb877a 100644 --- a/src/attributes.rs +++ b/src/attributes.rs @@ -1,4 +1,6 @@ -use gccjit::{FnAttribute, Function}; +#[cfg_attr(not(feature="master"), allow(unused_imports))] +use gccjit::FnAttribute; +use gccjit::Function; use rustc_attr::InstructionSetAttr; use rustc_codegen_ssa::target_features::tied_target_features; use rustc_data_structures::fx::FxHashMap; @@ -72,6 +74,7 @@ fn to_gcc_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]> { /// attributes. pub fn from_fn_attrs<'gcc, 'tcx>( cx: &CodegenCx<'gcc, 'tcx>, + #[cfg_attr(not(feature="master"), allow(unused_variables))] func: Function<'gcc>, instance: ty::Instance<'tcx>, ) { @@ -109,6 +112,7 @@ pub fn from_fn_attrs<'gcc, 'tcx>( function_features.extend(&mut global_features); let target_features = function_features.join(","); if !target_features.is_empty() { + #[cfg(feature="master")] func.add_attribute(FnAttribute::Target, &target_features); } } diff --git a/src/base.rs b/src/base.rs index 84d48d8591a7..9d81a01e7a61 100644 --- a/src/base.rs +++ b/src/base.rs @@ -100,20 +100,6 @@ pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol, supports_ context.add_command_line_option("-mvpclmulqdq"); context.add_command_line_option("-mavx"); - if env::var("CG_GCCJIT_ENABLE_AVX512").as_deref() == Ok("1") { - context.add_command_line_option("-mavx512f"); - context.add_command_line_option("-mavx512vpopcntdq"); - context.add_command_line_option("-mavx512vl"); - context.add_command_line_option("-mavx512vnni"); - context.add_command_line_option("-mavx512bw"); - context.add_command_line_option("-mavx512bitalg"); - context.add_command_line_option("-mavx512bf16"); - context.add_command_line_option("-mavx512vbmi2"); - context.add_command_line_option("-mavx512vbmi"); - context.add_command_line_option("-mavx512ifma"); - context.add_command_line_option("-mavx512cd"); - } - for arg in &tcx.sess.opts.cg.llvm_args { context.add_command_line_option(arg); } diff --git a/src/intrinsic/llvm.rs b/src/intrinsic/llvm.rs index f623bc5fb10c..f00c1b301097 100644 --- a/src/intrinsic/llvm.rs +++ b/src/intrinsic/llvm.rs @@ -287,9 +287,9 @@ pub fn adjust_intrinsic_arguments<'a, 'b, 'gcc, 'tcx>(builder: &Builder<'a, 'gcc pub fn adjust_intrinsic_return_value<'a, 'gcc, 'tcx>(builder: &Builder<'a, 'gcc, 'tcx>, mut return_value: RValue<'gcc>, func_name: &str, args: &[RValue<'gcc>], args_adjusted: bool) -> RValue<'gcc> { match func_name { "__builtin_ia32_vfmaddss3_round" | "__builtin_ia32_vfmaddsd3_round" => { - let zero = builder.context.new_rvalue_zero(builder.int_type); #[cfg(feature="master")] { + let zero = builder.context.new_rvalue_zero(builder.int_type); return_value = builder.context.new_vector_access(None, return_value, zero).to_rvalue(); } }, diff --git a/src/intrinsic/simd.rs b/src/intrinsic/simd.rs index 842b4a92080c..9c2a1401a154 100644 --- a/src/intrinsic/simd.rs +++ b/src/intrinsic/simd.rs @@ -1,4 +1,6 @@ -use gccjit::{BinaryOp, RValue, Type, ToRValue, ComparisonOp, UnaryOp}; +#[cfg_attr(not(feature="master"), allow(unused_imports))] +use gccjit::{ToRValue, ComparisonOp, UnaryOp}; +use gccjit::{BinaryOp, RValue, Type}; use rustc_codegen_ssa::base::compare_simd_types; use rustc_codegen_ssa::common::{TypeKind, span_invalid_monomorphization_error}; use rustc_codegen_ssa::mir::operand::OperandRef; diff --git a/src/lib.rs b/src/lib.rs index 1ca2394abdc2..cb1d848eb670 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -190,24 +190,6 @@ pub struct GccContext { context: Context<'static>, } -impl GccContext { - fn new<'tcx>(tcx: TyCtxt<'tcx>) -> Self { - let context = create_context(tcx); - Self { - context, - } - } -} - -fn create_context<'gcc, 'tcx>(tcx: TyCtxt<'tcx>) -> Context<'gcc> { - let context = Context::default(); - if tcx.sess.target.is_builtin { - //let features = global_gcc_features(sess, false); - println!("Features: {:?}", tcx.sess.opts.cg.target_feature); - } - context -} - unsafe impl Send for GccContext {} // FIXME(antoyo): that shouldn't be Sync. Parallel compilation is currently disabled with "-Zno-parallel-llvm". Try to disable it here. unsafe impl Sync for GccContext {}