Skip to content
Draft
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
11 changes: 10 additions & 1 deletion llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
Expand Down Expand Up @@ -68,6 +69,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
Expand Down Expand Up @@ -1379,8 +1381,15 @@ static void ExtendSpirKernelArgs(Module &M, FunctionAnalysisManager &FAM,
"sycl-device-global-size", std::to_string(DL.getTypeAllocSize(ArrayTy)));
AsanSpirKernelMetadata->addAttribute("sycl-device-image-scope");
AsanSpirKernelMetadata->addAttribute("sycl-host-access", "0"); // read only
// Create a memory buffer to hold the serialized module
std::string Buffer;
llvm::raw_string_ostream Stream(Buffer);
llvm::WriteBitcodeToFile(M, Stream);
Stream.flush();
auto ModuleHash = llvm::utohexstr(MD5Hash(Buffer), true);

AsanSpirKernelMetadata->addAttribute("sycl-unique-id",
"_Z20__AsanKernelMetadata");
"_Z20__AsanKernelMetadata" + ModuleHash);
AsanSpirKernelMetadata->setDSOLocal(true);

// Handle SpirFixupKernels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ entry:
attributes #0 = { sanitize_address }
;; sycl-device-global-size = 16 * 2
;; sycl-host-access = 0 read-only
; CHECK: attributes #{{.*}} = { "sycl-device-global-size"="32" "sycl-device-image-scope" "sycl-host-access"="0" "sycl-unique-id"="_Z20__AsanKernelMetadata" }
; CHECK: attributes #{{.*}} = { "sycl-device-global-size"="32" "sycl-device-image-scope" "sycl-host-access"="0" "sycl-unique-id"="_Z20__AsanKernelMetadata{{.*}}" }