Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,11 @@ static bool isUnsupportedDeviceGlobal(const GlobalVariable *G) {
return true;
if (G->getName().starts_with("__usid_str"))
return true;
// Globals with __profd/__profc prefix are inserted by profiling pass, we
// don't neeed to instrument them.
if (G->getName().starts_with("__profd") ||
G->getName().starts_with("__profc"))
return true;
if ((!ClSpirOffloadLocals && G->getAddressSpace() == kSpirOffloadLocalAS) ||
G->getAddressSpace() == kSpirOffloadConstantAS)
return true;
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,10 @@ bool ThreadSanitizerOnSpirv::isUnsupportedDeviceGlobal(
return true;
if (G.getName().starts_with("__usid_str"))
return true;
// Globals with __profd/__profc prefix are inserted by profiling pass, we
// don't neeed to instrument them.
if (G.getName().starts_with("__profd") || G.getName().starts_with("__profc"))
return true;
// Global variables have constant address space will not trigger race
// condition.
if (G.getAddressSpace() == kSpirOffloadConstantAS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ target triple = "spir64-unknown-unknown"
@dev_global_no_users = dso_local addrspace(1) global { [4 x i32] } zeroinitializer
@0 = internal global i32 0, align 4 ;nameless global
@1 = internal global i32 0, align 4 ;nameless global
@__profc_test.cpp__ZZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_ENKUlNS0_2idILi1EEEE_clES5_ = private addrspace(1) global { ptr addrspace(1), i64 } zeroinitializer
@__profd_test.cpp__ZZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_ENKUlNS0_2idILi1EEEE_clES5_ = private addrspace(1) global { i64, i64, i64, i64, ptr, ptr, i32, [4 x i16], i32 } { i64 6860770789959664611, i64 0, i64 sub (i64 ptrtoint (ptr addrspace(1) @__profc_test.cpp__ZZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_ENKUlNS0_2idILi1EEEE_clES5_ to i64), i64 ptrtoint (ptr addrspace(1) @__profd_test.cpp__ZZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_ENKUlNS0_2idILi1EEEE_clES5_ to i64)), i64 0, ptr null, ptr null, i32 1, [4 x i16] zeroinitializer, i32 0 }

define spir_func void @_ZZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_ENKUlvE_clEv() {
entry:
Expand All @@ -19,4 +21,6 @@ entry:
; CHECK: @__MsanDeviceGlobalMetadata
; CHECK-NOT: @__spirv_BuiltInGlobalInvocationId
; CHECK-NOT: @dev_global_no_users
; CHECK-NOT: @__profc
; CHECK-NOT: @__profd
; CHECK-SAME: @.str
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ target triple = "spir64-unknown-unknown"
@dev_global = external addrspace(1) global { [4 x i32] }
@dev_global_no_users = dso_local addrspace(1) global { [4 x i32] } zeroinitializer
@__spirv_BuiltInGlobalInvocationId = external addrspace(1) constant <3 x i64>
@__profc_test.cpp__ZZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_ENKUlNS0_2idILi1EEEE_clES5_ = private addrspace(1) global { ptr addrspace(1), i64 } zeroinitializer
@__profd_test.cpp__ZZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_ENKUlNS0_2idILi1EEEE_clES5_ = private addrspace(1) global { i64, i64, i64, i64, ptr, ptr, i32, [4 x i16], i32 } { i64 6860770789959664611, i64 0, i64 sub (i64 ptrtoint (ptr addrspace(1) @__profc_test.cpp__ZZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_ENKUlNS0_2idILi1EEEE_clES5_ to i64), i64 ptrtoint (ptr addrspace(1) @__profd_test.cpp__ZZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_ENKUlNS0_2idILi1EEEE_clES5_ to i64)), i64 0, ptr null, ptr null, i32 1, [4 x i16] zeroinitializer, i32 0 }

; CHECK: @__TsanDeviceGlobalMetadata
; CHECK-NOT: @dev_global_no_users
; CHECK-NOT: @__spirv_BuiltInGlobalInvocationId
; CHECK-NOT: @__profc
; CHECK-NOT: @__profd
; CHECK-SAME: @dev_global

define spir_func void @test() {
Expand Down