[llvm] 539f916 - [Instrumentation] Precommit tests for PR108552 (NFC)
Antonio Frighetto via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 17 00:07:01 PDT 2024
Author: Antonio Frighetto
Date: 2024-09-17T09:06:10+02:00
New Revision: 539f9161a28e1c90743586a2d7664160ce3815c8
URL: https://github.com/llvm/llvm-project/commit/539f9161a28e1c90743586a2d7664160ce3815c8
DIFF: https://github.com/llvm/llvm-project/commit/539f9161a28e1c90743586a2d7664160ce3815c8.diff
LOG: [Instrumentation] Precommit tests for PR108552 (NFC)
Added:
llvm/test/Instrumentation/sanitizers-naked.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Instrumentation/sanitizers-naked.ll b/llvm/test/Instrumentation/sanitizers-naked.ll
new file mode 100644
index 00000000000000..8af2ef03d3df3d
--- /dev/null
+++ b/llvm/test/Instrumentation/sanitizers-naked.ll
@@ -0,0 +1,115 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt < %s -passes=asan -S | FileCheck %s --check-prefixes=CHECK,CHECK-ASAN
+; RUN: opt < %s -passes=tsan -S | FileCheck %s --check-prefixes=CHECK,CHECK-TSAN
+; RUN: opt < %s -passes=msan -S | FileCheck %s --check-prefixes=CHECK,CHECK-MSAN
+; RUN: opt < %s -passes=hwasan -S | FileCheck %s --check-prefixes=CHECK,CHECK-HWASAN
+; RUN: opt < %s -passes='module(sancov-module)' -sanitizer-coverage-level=3 -sanitizer-coverage-control-flow -S | FileCheck %s --check-prefixes=CHECK,CHECK-SANCOV
+; RUN: opt < %s -passes='module(sanmd-module)' -sanitizer-metadata-atomics -S | FileCheck %s --check-prefixes=CHECK,CHECK-SANMD
+
+; REQUIRES: x86-registered-target
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @naked_function(ptr byval(i32) %p) {
+; CHECK-ASAN-LABEL: define void @naked_function(
+; CHECK-ASAN-SAME: ptr byval(i32) [[P:%.*]]) {
+; CHECK-ASAN-NEXT: call void asm sideeffect "nop", ""()
+; CHECK-ASAN-NEXT: unreachable
+;
+; CHECK-TSAN-LABEL: define void @naked_function(
+; CHECK-TSAN-SAME: ptr byval(i32) [[P:%.*]]) personality ptr @__gcc_personality_v0 {
+; CHECK-TSAN-NEXT: [[TMP1:%.*]] = call ptr @llvm.returnaddress(i32 0)
+; CHECK-TSAN-NEXT: call void @__tsan_func_entry(ptr [[TMP1]])
+; CHECK-TSAN-NEXT: invoke void asm sideeffect "nop", ""()
+; CHECK-TSAN-NEXT: to [[DOTNOEXC:label %.*]] unwind label %[[TSAN_CLEANUP:.*]]
+; CHECK-TSAN: [[_NOEXC:.*:]]
+; CHECK-TSAN-NEXT: unreachable
+; CHECK-TSAN: [[TSAN_CLEANUP]]:
+; CHECK-TSAN-NEXT: [[CLEANUP_LPAD:%.*]] = landingpad { ptr, i32 }
+; CHECK-TSAN-NEXT: cleanup
+; CHECK-TSAN-NEXT: call void @__tsan_func_exit()
+; CHECK-TSAN-NEXT: resume { ptr, i32 } [[CLEANUP_LPAD]]
+;
+; CHECK-MSAN-LABEL: define void @naked_function(
+; CHECK-MSAN-SAME: ptr byval(i32) [[P:%.*]]) {
+; CHECK-MSAN-NEXT: call void @llvm.donothing()
+; CHECK-MSAN-NEXT: call void asm sideeffect "nop", ""()
+; CHECK-MSAN-NEXT: unreachable
+;
+; CHECK-HWASAN-LABEL: define void @naked_function(
+; CHECK-HWASAN-SAME: ptr byval(i32) [[P:%.*]]) {
+; CHECK-HWASAN-NEXT: call void asm sideeffect "nop", ""()
+; CHECK-HWASAN-NEXT: unreachable
+;
+; CHECK-SANCOV-LABEL: define void @naked_function(
+; CHECK-SANCOV-SAME: ptr byval(i32) [[P:%.*]]) {
+; CHECK-SANCOV-NEXT: call void asm sideeffect "nop", ""()
+; CHECK-SANCOV-NEXT: unreachable
+;
+; CHECK-SANMD-LABEL: define void @naked_function(
+; CHECK-SANMD-SAME: ptr byval(i32) [[P:%.*]]) !pcsections [[META0:![0-9]+]] {
+; CHECK-SANMD-NEXT: call void asm sideeffect "nop", ""()
+; CHECK-SANMD-NEXT: unreachable
+;
+ call void asm sideeffect "nop", ""()
+ unreachable
+}
+
+define void @naked_function_with_asan(ptr byval(i32) %p) sanitize_address {
+; CHECK-ASAN-LABEL: define void @naked_function_with_asan(
+; CHECK-ASAN-SAME: ptr byval(i32) [[P:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-ASAN-NEXT: [[P_BYVAL:%.*]] = alloca i32, align 4
+; CHECK-ASAN-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[P_BYVAL]], ptr align 4 [[P]], i64 4, i1 false)
+; CHECK-ASAN-NEXT: call void asm sideeffect "nop", ""()
+; CHECK-ASAN-NEXT: unreachable
+;
+ call void asm sideeffect "nop", ""()
+ unreachable
+}
+
+define void @naked_function_with_tsan(ptr byval(i32) %p) sanitize_thread {
+; CHECK-TSAN-LABEL: define void @naked_function_with_tsan(
+; CHECK-TSAN-SAME: ptr byval(i32) [[P:%.*]]) #[[ATTR1:[0-9]+]] personality ptr @__gcc_personality_v0 {
+; CHECK-TSAN-NEXT: [[TMP1:%.*]] = call ptr @llvm.returnaddress(i32 0)
+; CHECK-TSAN-NEXT: call void @__tsan_func_entry(ptr [[TMP1]])
+; CHECK-TSAN-NEXT: invoke void asm sideeffect "nop", ""()
+; CHECK-TSAN-NEXT: to [[DOTNOEXC:label %.*]] unwind label %[[TSAN_CLEANUP:.*]]
+; CHECK-TSAN: [[_NOEXC:.*:]]
+; CHECK-TSAN-NEXT: unreachable
+; CHECK-TSAN: [[TSAN_CLEANUP]]:
+; CHECK-TSAN-NEXT: [[CLEANUP_LPAD:%.*]] = landingpad { ptr, i32 }
+; CHECK-TSAN-NEXT: cleanup
+; CHECK-TSAN-NEXT: call void @__tsan_func_exit()
+; CHECK-TSAN-NEXT: resume { ptr, i32 } [[CLEANUP_LPAD]]
+;
+ call void asm sideeffect "nop", ""()
+ unreachable
+}
+
+define void @naked_function_with_msan(ptr byval(i32) %p) sanitize_memory {
+; CHECK-MSAN-LABEL: define void @naked_function_with_msan(
+; CHECK-MSAN-SAME: ptr byval(i32) [[P:%.*]]) #[[ATTR2:[0-9]+]] {
+; CHECK-MSAN-NEXT: call void @llvm.donothing()
+; CHECK-MSAN-NEXT: call void asm sideeffect "nop", ""()
+; CHECK-MSAN-NEXT: unreachable
+;
+ call void asm sideeffect "nop", ""()
+ unreachable
+}
+
+define void @naked_function_with_hwasan(ptr byval(i32) %p) sanitize_hwaddress {
+; CHECK-HWASAN-LABEL: define void @naked_function_with_hwasan(
+; CHECK-HWASAN-SAME: ptr byval(i32) [[P:%.*]]) #[[ATTR3:[0-9]+]] {
+; CHECK-HWASAN-NEXT: call void asm sideeffect "nop", ""()
+; CHECK-HWASAN-NEXT: unreachable
+;
+ call void asm sideeffect "nop", ""()
+ unreachable
+}
+;.
+; CHECK-SANMD: [[META0]] = !{!"sanmd_covered2!C", [[META1:![0-9]+]]}
+; CHECK-SANMD: [[META1]] = !{i64 1}
+;.
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; CHECK: {{.*}}
More information about the llvm-commits
mailing list