vitalybuka created this revision.
vitalybuka added a reviewer: kda.
vitalybuka requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116064

Files:
  clang/test/CodeGen/attr-noundef-no-sanitize.cpp


Index: clang/test/CodeGen/attr-noundef-no-sanitize.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGen/attr-noundef-no-sanitize.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang -cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm 
-enable-noundef-analysis -fsanitize=memory %s -o - | FileCheck %s 
--check-prefixes=CHECK,NOUNDEF
+// RUN: %clang -cc1 -triple aarch64-gnu-linux -x c++ -S -emit-llvm 
-enable-noundef-analysis -fsanitize=memory %s -o - | FileCheck %s 
--check-prefixes=CHECK,NOUNDEF
+// RUN: %clang -cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm 
-enable-noundef-analysis -fsanitize=memory 
-fsanitize-ignorelist=%S/Inputs/sanitizer-special-case-list.sanitized.txt %s -o 
- | FileCheck %s --check-prefixes=CHECK,IGNORE
+// RUN: %clang -cc1 -triple aarch64-gnu-linux -x c++ -S -emit-llvm 
-enable-noundef-analysis -fsanitize=memory 
-fsanitize-ignorelist=%S/Inputs/sanitizer-special-case-list.sanitized.txt %s -o 
- | FileCheck %s --check-prefixes=CHECK,IGNORE
+
+int ret_trivial() { return {}; }
+// CHECK: define dso_local noundef i32 @{{.*}}ret_trivial{{.*}}(
+
+void pass_trivial(int e) {}
+// CHECK: define dso_local void @{{.*}}pass_trivial{{.*}}(i32 noundef %
+
+void call_trivial() {
+  pass_trivial(ret_trivial());
+  // CHECK: call noundef i32 @{{.*}}ret_trivial{{.*}}(
+  // CHECK: call void @{{.*}}pass_trivial{{.*}}(i32 noundef %
+}
+
+int ret_ignored() { return {}; }
+// NOUNDEF: define dso_local noundef i32 @{{.*}}ret_ignored{{.*}}(
+// IGNORE: define dso_local i32 @{{.*}}ret_ignored{{.*}}(
+
+void pass_ignored(int e) {}
+// NOUNDEF: define dso_local void @{{.*}}pass_ignored{{.*}}(i32 noundef %
+// IGNORE: define dso_local void @{{.*}}pass_ignored{{.*}}(i32 %
+
+void call_ignored() {
+  pass_ignored(ret_ignored());
+  // NOUNDEF: call noundef i32 @{{.*}}ret_ignored{{.*}}(
+  // IGNORE: call i32 @{{.*}}ret_ignored{{.*}}(
+  // NOUNDEF: call void @{{.*}}pass_ignored{{.*}}(i32 noundef %
+  // IGNORE: call void @{{.*}}pass_ignored{{.*}}(i32 %
+}


Index: clang/test/CodeGen/attr-noundef-no-sanitize.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGen/attr-noundef-no-sanitize.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang -cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm -enable-noundef-analysis -fsanitize=memory %s -o - | FileCheck %s --check-prefixes=CHECK,NOUNDEF
+// RUN: %clang -cc1 -triple aarch64-gnu-linux -x c++ -S -emit-llvm -enable-noundef-analysis -fsanitize=memory %s -o - | FileCheck %s --check-prefixes=CHECK,NOUNDEF
+// RUN: %clang -cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm -enable-noundef-analysis -fsanitize=memory -fsanitize-ignorelist=%S/Inputs/sanitizer-special-case-list.sanitized.txt %s -o - | FileCheck %s --check-prefixes=CHECK,IGNORE
+// RUN: %clang -cc1 -triple aarch64-gnu-linux -x c++ -S -emit-llvm -enable-noundef-analysis -fsanitize=memory -fsanitize-ignorelist=%S/Inputs/sanitizer-special-case-list.sanitized.txt %s -o - | FileCheck %s --check-prefixes=CHECK,IGNORE
+
+int ret_trivial() { return {}; }
+// CHECK: define dso_local noundef i32 @{{.*}}ret_trivial{{.*}}(
+
+void pass_trivial(int e) {}
+// CHECK: define dso_local void @{{.*}}pass_trivial{{.*}}(i32 noundef %
+
+void call_trivial() {
+  pass_trivial(ret_trivial());
+  // CHECK: call noundef i32 @{{.*}}ret_trivial{{.*}}(
+  // CHECK: call void @{{.*}}pass_trivial{{.*}}(i32 noundef %
+}
+
+int ret_ignored() { return {}; }
+// NOUNDEF: define dso_local noundef i32 @{{.*}}ret_ignored{{.*}}(
+// IGNORE: define dso_local i32 @{{.*}}ret_ignored{{.*}}(
+
+void pass_ignored(int e) {}
+// NOUNDEF: define dso_local void @{{.*}}pass_ignored{{.*}}(i32 noundef %
+// IGNORE: define dso_local void @{{.*}}pass_ignored{{.*}}(i32 %
+
+void call_ignored() {
+  pass_ignored(ret_ignored());
+  // NOUNDEF: call noundef i32 @{{.*}}ret_ignored{{.*}}(
+  // IGNORE: call i32 @{{.*}}ret_ignored{{.*}}(
+  // NOUNDEF: call void @{{.*}}pass_ignored{{.*}}(i32 noundef %
+  // IGNORE: call void @{{.*}}pass_ignored{{.*}}(i32 %
+}
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to