fixing freebsd unused import warning in core affinity. (#897)

fixing clang wrapper test passing llvm pass api support when there are actual passes.

Co-authored-by: Dongjia "toka" Zhang <tokazerkje@outlook.com>
This commit is contained in:
David CARLIER 2022-11-17 09:28:22 +00:00 committed by GitHub
parent ec38858b2d
commit d77769540a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -642,7 +642,7 @@ mod freebsd {
use alloc::vec::Vec; use alloc::vec::Vec;
use std::{mem, thread::available_parallelism}; use std::{mem, thread::available_parallelism};
use libc::{cpuset_getaffinity, cpuset_setaffinity, cpuset_t, CPU_SET}; use libc::{cpuset_setaffinity, cpuset_t, CPU_SET};
use super::CoreId; use super::CoreId;
use crate::Error; use crate::Error;
@ -688,7 +688,7 @@ mod freebsd {
// Try to get current core affinity mask. // Try to get current core affinity mask.
let result = unsafe { let result = unsafe {
cpuset_getaffinity( libc::cpuset_getaffinity(
CPU_LEVEL_WHICH, CPU_LEVEL_WHICH,
CPU_WHICH_PID, CPU_WHICH_PID,
-1, // Defaults to current thread -1, // Defaults to current thread

View File

@ -297,10 +297,12 @@ impl CompilerWrapper for ClangWrapper {
return Ok(args); return Ok(args);
} }
if self.use_new_pm { if !self.passes.is_empty() {
args.push("-fexperimental-new-pass-manager".into()); if self.use_new_pm {
} else { args.push("-fexperimental-new-pass-manager".into());
args.push("-flegacy-pass-manager".into()); } else {
args.push("-flegacy-pass-manager".into());
}
} }
for pass in &self.passes { for pass in &self.passes {
if self.use_new_pm { if self.use_new_pm {