Skip to content

Commit 438f412

Browse files
committed
skip asan completely if one module has esimd
1 parent 73adce2 commit 438f412

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1450,8 +1450,14 @@ PreservedAnalyses AddressSanitizerPass::run(Module &M,
14501450
const StackSafetyGlobalInfo *const SSGI =
14511451
ClUseStackSafety ? &MAM.getResult<StackSafetyGlobalAnalysis>(M) : nullptr;
14521452

1453-
if (Triple(M.getTargetTriple()).isSPIROrSPIRV())
1453+
if (Triple(M.getTargetTriple()).isSPIROrSPIRV()) {
14541454
ExtendSpirKernelArgs(M, FAM);
1455+
// FIXME: W/A skip instrumentation if this module has ESIMD
1456+
for (auto &F : M) {
1457+
if (F.hasMetadata("sycl_explicit_simd"))
1458+
return PreservedAnalyses::all();
1459+
}
1460+
}
14551461

14561462
for (Function &F : M) {
14571463
AddressSanitizer FunctionSanitizer(

llvm/test/Instrumentation/AddressSanitizer/SPIRV/sycl_esimd.ll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
44
target triple = "spir64-unknown-unknown"
55

6+
;;
7+
;; W/A: We skip asan completely if one module has esimd
8+
;;
9+
610
define spir_kernel void @sycl_kernel(ptr addrspace(1) %p) #0 {
711
; CHECK-LABEL: define spir_kernel void @sycl_kernel(ptr addrspace(1) %p, ptr addrspace(1) %__asan_launch) #0
812
entry:
913
%0 = load i32, ptr addrspace(1) %p, align 4
10-
; CHECK: store ptr addrspace(1) %__asan_launch, ptr addrspace(3) @__AsanLaunchInfo, align 8
11-
; CHECK: call void @__asan_load4
14+
; CHECK-NOT: store ptr addrspace(1) %__asan_launch, ptr addrspace(3) @__AsanLaunchInfo, align 8
15+
; CHECK-NOT: call void @__asan_load4
1216
ret void
1317
}
1418

0 commit comments

Comments
 (0)