[llvm] [WIP][AMDGPU][ASAN] Add amdgpu-asan-instrument-lds pass to instrument LDS (PR #83287)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 08:37:44 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 43f1fa99ca7d05be9545a102e15ad0d607887839 c1fd827d901ca0e819efdc5f1b19d16ae65817fc -- llvm/lib/Target/AMDGPU/AMDGPUAsanInstrumentLDSPass.cpp llvm/lib/Target/AMDGPU/AMDGPU.h llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsanInstrumentLDSPass.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsanInstrumentLDSPass.cpp
index f7a44387ff..25ba38ed9b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsanInstrumentLDSPass.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsanInstrumentLDSPass.cpp
@@ -41,7 +41,8 @@ namespace {
 // TODO: Just for testing purpose. Will be removed.
 cl::opt<bool> ReplaceLDSAndInstrument(
     "amdgpu-replace-lds-and-instrument",
-    cl::desc("Replace LDS accesses with malloc and don't do asan instrumentation."),
+    cl::desc(
+        "Replace LDS accesses with malloc and don't do asan instrumentation."),
     cl::init(true), cl::Hidden);
 
 const char kAMDGPUBallotName[] = "llvm.amdgcn.ballot.i64";
@@ -434,7 +435,8 @@ static bool AMDGPUAsanInstrumentLDSImpl(Module &M, DomTreeCallback DTCallback) {
       // Iterate over users instructions of global
       for (Use &U : make_early_inc_range(GV->uses())) {
         if (GEPOperator *GEP = dyn_cast<GEPOperator>(U.getUser())) {
-          Instruction *UserI = dyn_cast<Instruction>(GEP->use_begin()->getUser());
+          Instruction *UserI =
+              dyn_cast<Instruction>(GEP->use_begin()->getUser());
           bool IsStore = UserI ? isa<StoreInst>(UserI) : false;
           InstrumentAddress(M, IRB, UserI, UserI, U, {}, 8, IsStore, nullptr,
                             false);

``````````

</details>


https://github.com/llvm/llvm-project/pull/83287


More information about the llvm-commits mailing list