Change signature of target_features_cfg.
Currently it is called twice, once with `allow_unstable` set to true and once with it set to false. This results in some duplicated work. Most notably, for the LLVM backend, `LLVMRustHasFeature` is called twice for every feature, and it's moderately slow. For very short running compilations on platforms with many features (e.g. a `check` build of hello-world on x86) this is a significant fraction of runtime. This commit changes `target_features_cfg` so it is only called once, and it now returns a pair of feature sets. This halves the number of `LLVMRustHasFeature` calls.
This commit is contained in:
@@ -338,8 +338,8 @@ impl CodegenBackend for LlvmCodegenBackend {
|
||||
llvm_util::print_version();
|
||||
}
|
||||
|
||||
fn target_features_cfg(&self, sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
|
||||
target_features_cfg(sess, allow_unstable)
|
||||
fn target_features_cfg(&self, sess: &Session) -> (Vec<Symbol>, Vec<Symbol>) {
|
||||
target_features_cfg(sess)
|
||||
}
|
||||
|
||||
fn codegen_crate<'tcx>(
|
||||
|
||||
Reference in New Issue
Block a user