@@ -134,7 +134,12 @@ extern "C" LLVMPassRef LLVMRustCreateMemorySanitizerPass(int TrackOrigins, bool
134
134
const bool CompileKernel = false ;
135
135
136
136
return wrap (createMemorySanitizerLegacyPassPass (
137
- MemorySanitizerOptions{TrackOrigins, Recover, CompileKernel}));
137
+ #if LLVM_VERSION_GE(14, 0)
138
+ MemorySanitizerOptions{TrackOrigins, Recover, CompileKernel, /* EagerChecks=*/ true }
139
+ #else
140
+ MemorySanitizerOptions{TrackOrigins, Recover, CompileKernel}
141
+ #endif
142
+ ));
138
143
#else
139
144
report_fatal_error (" Legacy PM not supported with LLVM 15" );
140
145
#endif
@@ -930,10 +935,18 @@ LLVMRustOptimizeWithNewPassManager(
930
935
931
936
if (SanitizerOptions) {
932
937
if (SanitizerOptions->SanitizeMemory ) {
938
+ #if LLVM_VERSION_GE(14, 0)
939
+ MemorySanitizerOptions Options (
940
+ SanitizerOptions->SanitizeMemoryTrackOrigins ,
941
+ SanitizerOptions->SanitizeMemoryRecover ,
942
+ /* CompileKernel=*/ false ,
943
+ /* EagerChecks=*/ true );
944
+ #else
933
945
MemorySanitizerOptions Options (
934
946
SanitizerOptions->SanitizeMemoryTrackOrigins ,
935
947
SanitizerOptions->SanitizeMemoryRecover ,
936
948
/* CompileKernel=*/ false );
949
+ #endif
937
950
OptimizerLastEPCallbacks.push_back (
938
951
[Options](ModulePassManager &MPM, OptimizationLevel Level) {
939
952
#if LLVM_VERSION_GE(14, 0) && LLVM_VERSION_LT(16, 0)
0 commit comments