[clang] [llvm] [NFC][msan] Precommit test for merging warning blocks (PR #238706)
Vitaly Buka via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 4 08:56:32 PST 2026
https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/238706
>From 27ecea73547933d51622c539a28a663ce748112d Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Tue, 3 Nov 2026 23:31:14 -0800
Subject: [PATCH 1/3] [spr] update
Created using spr 2.0.0-beta.2
---
clang/test/CodeGen/sanitize-memory-merge.c | 19 +++++++++++++++++
.../MemorySanitizer/merge_checks.ll | 21 +++++++++++++++++++
2 files changed, 40 insertions(+)
create mode 100644 clang/test/CodeGen/sanitize-memory-merge.c
create mode 100644 llvm/test/Instrumentation/MemorySanitizer/merge_checks.ll
diff --git a/clang/test/CodeGen/sanitize-memory-merge.c b/clang/test/CodeGen/sanitize-memory-merge.c
new file mode 100644
index 00000000000000..4bb260e0b9657f
--- /dev/null
+++ b/clang/test/CodeGen/sanitize-memory-merge.c
@@ -0,0 +1,19 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --filter "call void @__msan_warning" --version 6
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=memory -O2 -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefixes=CHECK,NOMERGE
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=memory -fsanitize-merge=memory -O2 -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefixes=CHECK,MERGE
+
+// CHECK-LABEL: define dso_local noundef range(i32 0, 3) i32 @two_checks(
+// CHECK-SAME: ptr nofree noundef readonly captures(none) [[P:%.*]], ptr nofree noundef readonly captures(none) [[Q:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+// CHECK: call void @__msan_warning_noreturn() #[[ATTR2:[0-9]+]]
+// CHECK: call void @__msan_warning_noreturn() #[[ATTR2]]
+//
+int two_checks(int *p, int *q) {
+ if (*p)
+ return 1;
+ if (*q)
+ return 2;
+ return 0;
+}
+//// NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+// MERGE: {{.*}}
+// NOMERGE: {{.*}}
diff --git a/llvm/test/Instrumentation/MemorySanitizer/merge_checks.ll b/llvm/test/Instrumentation/MemorySanitizer/merge_checks.ll
new file mode 100644
index 00000000000000..dfc29536868fd9
--- /dev/null
+++ b/llvm/test/Instrumentation/MemorySanitizer/merge_checks.ll
@@ -0,0 +1,21 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --filter "call void @__msan_warning" --version 6
+; RUN: opt < %s -S -passes=msan | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefixes=CHECK,NOMERGE
+; RUN: opt < %s -S -passes=msan | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefixes=CHECK,MERGE
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @two_checks(ptr %p, ptr %q) sanitize_memory {
+; CHECK-LABEL: define i32 @two_checks(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK: call void @__msan_warning_noreturn() #[[ATTR3:[0-9]+]]
+; CHECK: call void @__msan_warning_noreturn() #[[ATTR3]]
+;
+ %a = load i32, ptr %p, align 4
+ %b = load i32, ptr %q, align 4
+ %s = add i32 %a, %b
+ ret i32 %s
+}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; MERGE: {{.*}}
+; NOMERGE: {{.*}}
>From f06284460753813932c993d358bb79efa68732eb Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Wed, 4 Nov 2026 08:54:04 -0800
Subject: [PATCH 2/3] [spr] update
Created using spr 2.0.0-beta.2
---
clang/test/CodeGen/sanitize-memory-merge.c | 20 ++++++++++---------
.../MemorySanitizer/merge_checks.ll | 20 ++++++++++---------
2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/clang/test/CodeGen/sanitize-memory-merge.c b/clang/test/CodeGen/sanitize-memory-merge.c
index 4bb260e0b9657f..c3f33aaeea66bc 100644
--- a/clang/test/CodeGen/sanitize-memory-merge.c
+++ b/clang/test/CodeGen/sanitize-memory-merge.c
@@ -1,11 +1,16 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --filter "call void @__msan_warning" --version 6
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=memory -O2 -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefixes=CHECK,NOMERGE
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=memory -fsanitize-merge=memory -O2 -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefixes=CHECK,MERGE
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=memory -O2 -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefix=NOMERGE
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=memory -fsanitize-merge=memory -O2 -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefix=MERGE
-// CHECK-LABEL: define dso_local noundef range(i32 0, 3) i32 @two_checks(
-// CHECK-SAME: ptr nofree noundef readonly captures(none) [[P:%.*]], ptr nofree noundef readonly captures(none) [[Q:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
-// CHECK: call void @__msan_warning_noreturn() #[[ATTR2:[0-9]+]]
-// CHECK: call void @__msan_warning_noreturn() #[[ATTR2]]
+// NOMERGE-LABEL: define dso_local noundef range(i32 0, 3) i32 @two_checks(
+// NOMERGE-SAME: ptr nofree noundef readonly captures(none) [[P:%.*]], ptr nofree noundef readonly captures(none) [[Q:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+// NOMERGE: call void @__msan_warning_noreturn() #[[ATTR2:[0-9]+]]
+// NOMERGE: call void @__msan_warning_noreturn() #[[ATTR2]]
+//
+// 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)
@@ -14,6 +19,3 @@ int two_checks(int *p, int *q) {
return 2;
return 0;
}
-//// NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
-// MERGE: {{.*}}
-// NOMERGE: {{.*}}
diff --git a/llvm/test/Instrumentation/MemorySanitizer/merge_checks.ll b/llvm/test/Instrumentation/MemorySanitizer/merge_checks.ll
index dfc29536868fd9..66c8bdb8b70b11 100644
--- a/llvm/test/Instrumentation/MemorySanitizer/merge_checks.ll
+++ b/llvm/test/Instrumentation/MemorySanitizer/merge_checks.ll
@@ -1,21 +1,23 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --filter "call void @__msan_warning" --version 6
-; RUN: opt < %s -S -passes=msan | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefixes=CHECK,NOMERGE
-; RUN: opt < %s -S -passes=msan | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefixes=CHECK,MERGE
+; RUN: opt < %s -S -passes=msan | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefix=NOMERGE
+; RUN: opt < %s -S -passes=msan | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefix=MERGE
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define i32 @two_checks(ptr %p, ptr %q) sanitize_memory {
-; CHECK-LABEL: define i32 @two_checks(
-; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK: call void @__msan_warning_noreturn() #[[ATTR3:[0-9]+]]
-; CHECK: call void @__msan_warning_noreturn() #[[ATTR3]]
+; NOMERGE-LABEL: define i32 @two_checks(
+; NOMERGE-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) #[[ATTR0:[0-9]+]] {
+; NOMERGE: call void @__msan_warning_noreturn() #[[ATTR3:[0-9]+]]
+; NOMERGE: call void @__msan_warning_noreturn() #[[ATTR3]]
+;
+; MERGE-LABEL: define i32 @two_checks(
+; MERGE-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) #[[ATTR0:[0-9]+]] {
+; MERGE: call void @__msan_warning_noreturn() #[[ATTR3:[0-9]+]]
+; MERGE: call void @__msan_warning_noreturn() #[[ATTR3]]
;
%a = load i32, ptr %p, align 4
%b = load i32, ptr %q, align 4
%s = add i32 %a, %b
ret i32 %s
}
-;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
-; MERGE: {{.*}}
-; NOMERGE: {{.*}}
>From a19c00cd3a112fff2a7bb1e056da69d7dcc1cf8a Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Wed, 4 Nov 2026 08:56:19 -0800
Subject: [PATCH 3/3] [spr] update
Created using spr 2.0.0-beta.2
---
clang/test/CodeGen/sanitize-memory-merge.c | 21 ---------------------
1 file changed, 21 deletions(-)
delete mode 100644 clang/test/CodeGen/sanitize-memory-merge.c
diff --git a/clang/test/CodeGen/sanitize-memory-merge.c b/clang/test/CodeGen/sanitize-memory-merge.c
deleted file mode 100644
index c3f33aaeea66bc..00000000000000
--- a/clang/test/CodeGen/sanitize-memory-merge.c
+++ /dev/null
@@ -1,21 +0,0 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --filter "call void @__msan_warning" --version 6
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=memory -O2 -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefix=NOMERGE
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=memory -fsanitize-merge=memory -O2 -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__msan_warning" --check-prefix=MERGE
-
-// NOMERGE-LABEL: define dso_local noundef range(i32 0, 3) i32 @two_checks(
-// NOMERGE-SAME: ptr nofree noundef readonly captures(none) [[P:%.*]], ptr nofree noundef readonly captures(none) [[Q:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
-// NOMERGE: call void @__msan_warning_noreturn() #[[ATTR2:[0-9]+]]
-// NOMERGE: call void @__msan_warning_noreturn() #[[ATTR2]]
-//
-// 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)
- return 1;
- if (*q)
- return 2;
- return 0;
-}
More information about the cfe-commits
mailing list