1
Fork 0

Removes the useless DisableSimplifyLibCalls parameter.

After applying no_builtins to the function attributes, we can remove the
DisableSimplifyLibCalls parameter.
This commit is contained in:
DianQK 2023-08-10 19:01:38 +08:00
parent 520081721c
commit 6762d64063
No known key found for this signature in database
GPG key ID: 46BDB1AC96C48912
3 changed files with 6 additions and 19 deletions

View file

@ -563,7 +563,6 @@ pub(crate) unsafe fn llvm_optimize(
unroll_loops, unroll_loops,
config.vectorize_slp, config.vectorize_slp,
config.vectorize_loop, config.vectorize_loop,
config.no_builtins,
config.emit_lifetime_markers, config.emit_lifetime_markers,
sanitizer_options.as_ref(), sanitizer_options.as_ref(),
pgo_gen_path.as_ref().map_or(std::ptr::null(), |s| s.as_ptr()), pgo_gen_path.as_ref().map_or(std::ptr::null(), |s| s.as_ptr()),
@ -678,7 +677,6 @@ pub(crate) unsafe fn codegen(
unsafe fn with_codegen<'ll, F, R>( unsafe fn with_codegen<'ll, F, R>(
tm: &'ll llvm::TargetMachine, tm: &'ll llvm::TargetMachine,
llmod: &'ll llvm::Module, llmod: &'ll llvm::Module,
no_builtins: bool,
f: F, f: F,
) -> R ) -> R
where where
@ -686,7 +684,7 @@ pub(crate) unsafe fn codegen(
{ {
let cpm = llvm::LLVMCreatePassManager(); let cpm = llvm::LLVMCreatePassManager();
llvm::LLVMAddAnalysisPasses(tm, cpm); llvm::LLVMAddAnalysisPasses(tm, cpm);
llvm::LLVMRustAddLibraryInfo(cpm, llmod, no_builtins); llvm::LLVMRustAddLibraryInfo(cpm, llmod);
f(cpm) f(cpm)
} }
@ -789,7 +787,7 @@ pub(crate) unsafe fn codegen(
} else { } else {
llmod llmod
}; };
with_codegen(tm, llmod, config.no_builtins, |cpm| { with_codegen(tm, llmod, |cpm| {
write_output_file( write_output_file(
diag_handler, diag_handler,
tm, tm,
@ -824,7 +822,7 @@ pub(crate) unsafe fn codegen(
(_, SplitDwarfKind::Split) => Some(dwo_out.as_path()), (_, SplitDwarfKind::Split) => Some(dwo_out.as_path()),
}; };
with_codegen(tm, llmod, config.no_builtins, |cpm| { with_codegen(tm, llmod, |cpm| {
write_output_file( write_output_file(
diag_handler, diag_handler,
tm, tm,

View file

@ -2139,13 +2139,8 @@ extern "C" {
ArgsCstrBuff: *const c_char, ArgsCstrBuff: *const c_char,
ArgsCstrBuffLen: usize, ArgsCstrBuffLen: usize,
) -> *mut TargetMachine; ) -> *mut TargetMachine;
pub fn LLVMRustDisposeTargetMachine(T: *mut TargetMachine); pub fn LLVMRustDisposeTargetMachine(T: *mut TargetMachine);
pub fn LLVMRustAddLibraryInfo<'a>( pub fn LLVMRustAddLibraryInfo<'a>(PM: &PassManager<'a>, M: &'a Module);
PM: &PassManager<'a>,
M: &'a Module,
DisableSimplifyLibCalls: bool,
);
pub fn LLVMRustWriteOutputFile<'a>( pub fn LLVMRustWriteOutputFile<'a>(
T: &'a TargetMachine, T: &'a TargetMachine,
PM: &PassManager<'a>, PM: &PassManager<'a>,
@ -2167,7 +2162,6 @@ extern "C" {
UnrollLoops: bool, UnrollLoops: bool,
SLPVectorize: bool, SLPVectorize: bool,
LoopVectorize: bool, LoopVectorize: bool,
DisableSimplifyLibCalls: bool,
EmitLifetimeMarkers: bool, EmitLifetimeMarkers: bool,
SanitizerOptions: Option<&SanitizerOptions>, SanitizerOptions: Option<&SanitizerOptions>,
PGOGenPath: *const c_char, PGOGenPath: *const c_char,

View file

@ -535,12 +535,9 @@ extern "C" void LLVMRustDisposeTargetMachine(LLVMTargetMachineRef TM) {
// Unfortunately, the LLVM C API doesn't provide a way to create the // Unfortunately, the LLVM C API doesn't provide a way to create the
// TargetLibraryInfo pass, so we use this method to do so. // TargetLibraryInfo pass, so we use this method to do so.
extern "C" void LLVMRustAddLibraryInfo(LLVMPassManagerRef PMR, LLVMModuleRef M, extern "C" void LLVMRustAddLibraryInfo(LLVMPassManagerRef PMR, LLVMModuleRef M) {
bool DisableSimplifyLibCalls) {
Triple TargetTriple(unwrap(M)->getTargetTriple()); Triple TargetTriple(unwrap(M)->getTargetTriple());
TargetLibraryInfoImpl TLII(TargetTriple); TargetLibraryInfoImpl TLII(TargetTriple);
if (DisableSimplifyLibCalls)
TLII.disableAllFunctions();
unwrap(PMR)->add(new TargetLibraryInfoWrapperPass(TLII)); unwrap(PMR)->add(new TargetLibraryInfoWrapperPass(TLII));
} }
@ -707,7 +704,7 @@ LLVMRustOptimize(
bool IsLinkerPluginLTO, bool IsLinkerPluginLTO,
bool NoPrepopulatePasses, bool VerifyIR, bool UseThinLTOBuffers, bool NoPrepopulatePasses, bool VerifyIR, bool UseThinLTOBuffers,
bool MergeFunctions, bool UnrollLoops, bool SLPVectorize, bool LoopVectorize, bool MergeFunctions, bool UnrollLoops, bool SLPVectorize, bool LoopVectorize,
bool DisableSimplifyLibCalls, bool EmitLifetimeMarkers, bool EmitLifetimeMarkers,
LLVMRustSanitizerOptions *SanitizerOptions, LLVMRustSanitizerOptions *SanitizerOptions,
const char *PGOGenPath, const char *PGOUsePath, const char *PGOGenPath, const char *PGOUsePath,
bool InstrumentCoverage, const char *InstrProfileOutput, bool InstrumentCoverage, const char *InstrProfileOutput,
@ -813,8 +810,6 @@ LLVMRustOptimize(
Triple TargetTriple(TheModule->getTargetTriple()); Triple TargetTriple(TheModule->getTargetTriple());
std::unique_ptr<TargetLibraryInfoImpl> TLII(new TargetLibraryInfoImpl(TargetTriple)); std::unique_ptr<TargetLibraryInfoImpl> TLII(new TargetLibraryInfoImpl(TargetTriple));
if (DisableSimplifyLibCalls)
TLII->disableAllFunctions();
FAM.registerPass([&] { return TargetLibraryAnalysis(*TLII); }); FAM.registerPass([&] { return TargetLibraryAnalysis(*TLII); });
PB.registerModuleAnalyses(MAM); PB.registerModuleAnalyses(MAM);