[clang] 66f9448 - [NFC][ubsan] Pre-commit test with missed optimization (#119012)

via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 7 14:50:23 PST 2024


Author: Vitaly Buka
Date: 2024-12-07T14:50:19-08:00
New Revision: 66f9448b4b14a117141a3efd014e1240b30b741f

URL: https://github.com/llvm/llvm-project/commit/66f9448b4b14a117141a3efd014e1240b30b741f
DIFF: https://github.com/llvm/llvm-project/commit/66f9448b4b14a117141a3efd014e1240b30b741f.diff

LOG: [NFC][ubsan] Pre-commit test with missed optimization (#119012)

Added: 
    clang/test/CodeGen/allow-ubsan-check-inline.c

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGen/allow-ubsan-check-inline.c b/clang/test/CodeGen/allow-ubsan-check-inline.c
new file mode 100644
index 00000000000000..cabe76d8034d77
--- /dev/null
+++ b/clang/test/CodeGen/allow-ubsan-check-inline.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s -fsanitize=signed-integer-overflow -mllvm -ubsan-guard-checks -O3 -mllvm -lower-allow-check-random-rate=1 -Rpass=lower-allow-check -Rpass-missed=lower-allow-check -fno-inline 2>&1 | FileCheck %s --check-prefixes=NOINL --implicit-check-not="remark:"
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s -fsanitize=signed-integer-overflow -mllvm -ubsan-guard-checks -O3 -mllvm -lower-allow-check-random-rate=1 -Rpass=lower-allow-check -Rpass-missed=lower-allow-check 2>&1 | FileCheck %s --check-prefixes=INLINE --implicit-check-not="remark:"
+
+int get();
+void set(int x);
+
+// We will only make decision in the `overflow` function.
+// NOINL-COUNT-1: remark: Allowed check:
+
+// FIXME: We will make decision on every inline.
+// INLINE-COUNT-1: remark: Allowed check:
+
+static void overflow() {
+  set(get() + get());
+}
+
+void test() {
+  overflow();
+  overflow();
+  overflow();
+  overflow();
+  overflow();
+}


        


More information about the cfe-commits mailing list