[PATCH] D130682: Emit AMDGPU intrinsics only for target triple AMDGPU
praveen velliengiri via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 27 22:50:12 PDT 2022
pvellien created this revision.
pvellien added reviewers: b-sumner, kcc, MaskRay.
Herald added subscribers: Enna1, kosarev, StephenFan, hiraditya, t-tye, tpr, dstuttard, yaxunl, kzhuravl.
Herald added a project: All.
pvellien requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
The functions @llvm.amdgcn.is.private and @llvm.amdgcn.is.shared is emitted for all module which are instrumented regardless of target triple. This patch attempts to fix that behavior by emitting them only for AMDGPU target.
Repository:
rG LLVM Github Monorepo
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.448238.patch
Type: text/x-patch
Size: 1709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220728/69bd6da3/attachment.bin>
More information about the llvm-commits
mailing list