ZigLLVMTargetMachineEmitToFile: put sanitizers in registerOptimizerLastEPCallback
matching the default of clang's behavior. I originally put them in registerOptimizerEarlyEPCallback because I thought clang was doing that, but I see now it is behind the flag `--sanitizer-early-opt-ep` which is disabled by default.
This commit is contained in:
@@ -311,7 +311,10 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi
|
||||
}
|
||||
});
|
||||
|
||||
pass_builder.registerOptimizerEarlyEPCallback([&](ModulePassManager &module_pm, OptimizationLevel OL) {
|
||||
//pass_builder.registerOptimizerEarlyEPCallback([&](ModulePassManager &module_pm, OptimizationLevel OL) {
|
||||
//});
|
||||
|
||||
pass_builder.registerOptimizerLastEPCallback([&](ModulePassManager &module_pm, OptimizationLevel level) {
|
||||
// Code coverage instrumentation.
|
||||
if (options.sancov) {
|
||||
module_pm.addPass(SanitizerCoveragePass(getSanCovOptions(options.coverage)));
|
||||
@@ -322,9 +325,7 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi
|
||||
module_pm.addPass(ModuleThreadSanitizerPass());
|
||||
module_pm.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass()));
|
||||
}
|
||||
});
|
||||
|
||||
pass_builder.registerOptimizerLastEPCallback([&](ModulePassManager &module_pm, OptimizationLevel level) {
|
||||
// Verify the output
|
||||
if (assertions_on) {
|
||||
module_pm.addPass(VerifierPass());
|
||||
|
||||
Reference in New Issue
Block a user