llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-codegen Author: Vitaly Buka (vitalybuka) <details> <summary>Changes</summary> Wire `CodeGenOpts.SanitizeMergeHandlers.has(Mask)` to `MemorySanitizerOptions::MergeChecks` when scheduling `MemorySanitizerPass`. This reduces `.text` size by ~0.5% on `clang` and up to 4.8% on large binaries with exceptions enabled. Related to https://github.com/rust-lang/rust/issues/165040 (reducing MSan binary size to offset the size overhead of fixing that issue). Assisted-by: Gemini --- Full diff: https://github.com/llvm/llvm-project/pull/238870.diff 2 Files Affected: - (modified) clang/lib/CodeGen/BackendUtil.cpp (+4-2) - (modified) clang/test/CodeGen/sanitize-memory-merge.c (-1) ``````````diff diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index e04934548176f..9e8d44e24ce43 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -680,8 +680,10 @@ static void addSanitizers(const Triple &TargetTriple, int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins; bool Recover = CodeGenOpts.SanitizeRecover.has(Mask); - MemorySanitizerOptions options(TrackOrigins, Recover, CompileKernel, - CodeGenOpts.SanitizeMemoryParamRetval); + MemorySanitizerOptions options( + TrackOrigins, Recover, CompileKernel, + CodeGenOpts.SanitizeMemoryParamRetval, + CodeGenOpts.SanitizeMergeHandlers.has(Mask)); MPM.addPass(MemorySanitizerPass(options)); if (Level != OptimizationLevel::O0) { // MemorySanitizer inserts complex instrumentation that mostly follows diff --git a/clang/test/CodeGen/sanitize-memory-merge.c b/clang/test/CodeGen/sanitize-memory-merge.c index c3f33aaeea66b..4d5e2a88ea681 100644 --- a/clang/test/CodeGen/sanitize-memory-merge.c +++ b/clang/test/CodeGen/sanitize-memory-merge.c @@ -10,7 +10,6 @@ // MERGE-LABEL: define dso_local noundef range(i32 0, 3) i32 @two_checks( // MERGE-SAME: ptr nofree noundef readonly captures(none) [[P:%.*]], ptr nofree noundef readonly captures(none) [[Q:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { // MERGE: call void @__msan_warning_noreturn() #[[ATTR2:[0-9]+]] -// MERGE: call void @__msan_warning_noreturn() #[[ATTR2]] // int two_checks(int *p, int *q) { if (*p) `````````` </details> https://github.com/llvm/llvm-project/pull/238870 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
