aboutsummaryrefslogtreecommitdiff
path: root/src/zig_llvm.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-08-10 17:29:14 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-08-13 15:02:53 -0700
commite8e49efe211f85d854388e95c6fe0344f133ea2d (patch)
tree2b0a202ce086e78cb8dedf95d25ba56e5e642452 /src/zig_llvm.cpp
parentb5398180d6b362346522a6067d54b90b97e23dc2 (diff)
downloadzig-e8e49efe211f85d854388e95c6fe0344f133ea2d.tar.gz
zig-e8e49efe211f85d854388e95c6fe0344f133ea2d.zip
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 (limited to 'src/zig_llvm.cpp')
-rw-r--r--src/zig_llvm.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp
index 167e7a162f..6fa6f028dc 100644
--- 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());