commit e8e49efe211f85d854388e95c6fe0344f133ea2d (tree)
parent b5398180d6b362346522a6067d54b90b97e23dc2
Author: Andrew Kelley <andrew@ziglang.org>
Date: Sat, 10 Aug 2024 17:29:14 -0700
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.
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp
@@ -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());