[PATCH] D130682: [ASAN] Emit AMDGPU intrinsics only for target triple AMDGPU

praveen velliengiri via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 23:09:35 PDT 2022


pvellien updated this revision to Diff 449189.
pvellien added a comment.

Retry build.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130682/new/

https://reviews.llvm.org/D130682

Files:
  llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
  llvm/test/Instrumentation/AddressSanitizer/basic.ll


Index: llvm/test/Instrumentation/AddressSanitizer/basic.ll
===================================================================
--- llvm/test/Instrumentation/AddressSanitizer/basic.ll
+++ llvm/test/Instrumentation/AddressSanitizer/basic.ll
@@ -187,6 +187,11 @@
   ret void
 }
 
+; CHECK: declare void @__asan_handle_no_return()
+; CHECK-NOT: declare i1 @llvm.amdgcn.is.private
+; CHECK-NOT: declare i1 @llvm.amdgcn.is.shared
+; CHECK: declare void @__asan_init()
+
 ;; ctor/dtor have the nounwind attribute. See uwtable.ll, they additionally have
 ;; the uwtable attribute with the module flag "uwtable".
 ; CHECK: define internal void @asan.module_ctor() #[[#ATTR:]] {{(comdat )?}}{
Index: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -2532,10 +2532,12 @@
     AsanShadowGlobal = M.getOrInsertGlobal("__asan_shadow",
                                            ArrayType::get(IRB.getInt8Ty(), 0));
 
-  AMDGPUAddressShared = M.getOrInsertFunction(
-      kAMDGPUAddressSharedName, IRB.getInt1Ty(), IRB.getInt8PtrTy());
-  AMDGPUAddressPrivate = M.getOrInsertFunction(
-      kAMDGPUAddressPrivateName, IRB.getInt1Ty(), IRB.getInt8PtrTy());
+ if (TargetTriple.isAMDGPU()) {
+    AMDGPUAddressShared = M.getOrInsertFunction(
+        kAMDGPUAddressSharedName, IRB.getInt1Ty(), IRB.getInt8PtrTy());
+    AMDGPUAddressPrivate = M.getOrInsertFunction(
+        kAMDGPUAddressPrivateName, IRB.getInt1Ty(), IRB.getInt8PtrTy());
+ }
 }
 
 bool AddressSanitizer::maybeInsertAsanInitAtFunctionEntry(Function &F) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130682.449189.patch
Type: text/x-patch
Size: 1709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220802/e966e844/attachment.bin>


More information about the llvm-commits mailing list