about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-03-11 12:05:16 +0000
committerbors <bors@rust-lang.org>2025-03-11 12:05:16 +0000
commitebf0cf75d368c035f4c7e7246d203bd469ee4a51 (patch)
tree1c26d90ad88273c67bd0f169b122ebd9a4b88e84 /compiler/rustc_interface/src
parent705421b52239d7393b4738764b192179d5c139c2 (diff)
parentcee311454427bf5049f5493bb7c7d74df2abb369 (diff)
downloadrust-ebf0cf75d368c035f4c7e7246d203bd469ee4a51.tar.gz
rust-ebf0cf75d368c035f4c7e7246d203bd469ee4a51.zip
Auto merge of #137586 - nnethercote:SetImpliedBits, r=bjorn3
Speed up target feature computation

The LLVM backend calls `LLVMRustHasFeature` twice for every feature. In short-running rustc invocations, this accounts for a surprising amount of work.

r? `@bjorn3`
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/util.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs
index bc2aae7cd87..5cccab893bb 100644
--- a/compiler/rustc_interface/src/util.rs
+++ b/compiler/rustc_interface/src/util.rs
@@ -39,11 +39,11 @@ pub(crate) fn add_configuration(
 ) {
     let tf = sym::target_feature;
 
-    let unstable_target_features = codegen_backend.target_features_cfg(sess, true);
-    sess.unstable_target_features.extend(unstable_target_features.iter().cloned());
+    let (target_features, unstable_target_features) = codegen_backend.target_features_cfg(sess);
 
-    let target_features = codegen_backend.target_features_cfg(sess, false);
-    sess.target_features.extend(target_features.iter().cloned());
+    sess.unstable_target_features.extend(unstable_target_features.iter().copied());
+
+    sess.target_features.extend(target_features.iter().copied());
 
     cfg.extend(target_features.into_iter().map(|feat| (tf, Some(feat))));