From b2490299fc2029f9b43be51f80003ebcf804f7ac Mon Sep 17 00:00:00 2001 From: Christopher Serr Date: Fri, 26 Jun 2020 17:53:52 +0200 Subject: [PATCH] Check for feature with pre-interned symbol --- src/librustc_codegen_llvm/builder.rs | 17 ++++++++--------- src/librustc_codegen_llvm/llvm_util.rs | 2 +- src/librustc_span/symbol.rs | 1 + 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index a6b55fee870..83cd0dbfcd4 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -18,6 +18,7 @@ use rustc_hir::def_id::DefId; use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::ty::{self, Ty, TyCtxt}; +use rustc_span::sym; use rustc_target::abi::{self, Align, Size}; use rustc_target::spec::{HasTargetSpec, Target}; use std::borrow::Cow; @@ -478,7 +479,11 @@ fn scalar_load_metadata<'a, 'll, 'tcx>( let llptr = self.struct_gep(place.llval, i as u64); let load = self.load(llptr, align); scalar_load_metadata(self, load, scalar); - if scalar.is_bool() { self.trunc(load, self.type_i1()) } else { load } + if scalar.is_bool() { + self.trunc(load, self.type_i1()) + } else { + load + } }; OperandValue::Pair( @@ -654,10 +659,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> { if self.sess().target.target.arch == "wasm32" - && self - .sess() - .target_features - .contains(&rustc_span::symbol::Symbol::intern("nontrapping-fptoint")) + && self.sess().target_features.contains(&sym::wasm_nontrapping_fptoint) { let src_ty = self.cx.val_ty(val); let float_width = self.cx.float_width(src_ty); @@ -679,10 +681,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> { if self.sess().target.target.arch == "wasm32" - && self - .sess() - .target_features - .contains(&rustc_span::symbol::Symbol::intern("nontrapping-fptoint")) + && self.sess().target_features.contains(&sym::wasm_nontrapping_fptoint) { let src_ty = self.cx.val_ty(val); let float_width = self.cx.float_width(src_ty); diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs index 5ec93b0d403..2e2ce154410 100644 --- a/src/librustc_codegen_llvm/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -253,7 +253,7 @@ pub fn time_trace_profiler_finish(file_name: &str) { const WASM_WHITELIST: &[(&str, Option)] = &[ ("simd128", Some(sym::wasm_target_feature)), ("atomics", Some(sym::wasm_target_feature)), - ("nontrapping-fptoint", Some(sym::wasm_target_feature)), // TODO: Maybe None? + ("nontrapping-fptoint", Some(sym::wasm_target_feature)), ]; /// When rustdoc is running, provide a list of all known features so that all their respective diff --git a/src/librustc_span/symbol.rs b/src/librustc_span/symbol.rs index e2f0d0b94c4..2f0a0584a30 100644 --- a/src/librustc_span/symbol.rs +++ b/src/librustc_span/symbol.rs @@ -844,6 +844,7 @@ warn, wasm_import_module, wasm_target_feature, + wasm_nontrapping_fptoint: "nontrapping-fptoint", while_let, windows, windows_subsystem, -- 2.44.0