[clang] [llvm] [HIP][HIPSTDPAR] Re-work allocation interposition for `hipstdpar` (PR #138790)
via cfe-commits
cfe-commits at lists.llvm.org
Tue May 6 18:01:27 PDT 2025
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 HEAD~1 HEAD --extensions c,cpp -- clang/lib/Frontend/InitPreprocessor.cpp clang/test/Preprocessor/predefined-macros.c llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp b/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
index 03a65152e..5a87cf8c8 100644
--- a/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
+++ b/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
@@ -231,57 +231,55 @@ PreservedAnalyses
}
static constexpr std::pair<StringLiteral, StringLiteral> ReplaceMap[]{
- {"aligned_alloc", "__hipstdpar_aligned_alloc"},
- {"calloc", "__hipstdpar_calloc"},
- {"free", "__hipstdpar_free"},
- {"malloc", "__hipstdpar_malloc"},
- {"memalign", "__hipstdpar_aligned_alloc"},
- {"mmap", "__hipstdpar_mmap"},
- {"munmap", "__hipstdpar_munmap"},
- {"posix_memalign", "__hipstdpar_posix_aligned_alloc"},
- {"realloc", "__hipstdpar_realloc"},
- {"reallocarray", "__hipstdpar_realloc_array"},
- {"_ZdaPv", "__hipstdpar_operator_delete"},
- {"_ZdaPvm", "__hipstdpar_operator_delete_sized"},
- {"_ZdaPvSt11align_val_t", "__hipstdpar_operator_delete_aligned"},
- {"_ZdaPvmSt11align_val_t", "__hipstdpar_operator_delete_aligned_sized"},
- {"_ZdlPv", "__hipstdpar_operator_delete"},
- {"_ZdlPvm", "__hipstdpar_operator_delete_sized"},
- {"_ZdlPvSt11align_val_t", "__hipstdpar_operator_delete_aligned"},
- {"_ZdlPvmSt11align_val_t", "__hipstdpar_operator_delete_aligned_sized"},
- {"_Znam", "__hipstdpar_operator_new"},
- {"_ZnamRKSt9nothrow_t", "__hipstdpar_operator_new_nothrow"},
- {"_ZnamSt11align_val_t", "__hipstdpar_operator_new_aligned"},
- {"_ZnamSt11align_val_tRKSt9nothrow_t",
- "__hipstdpar_operator_new_aligned_nothrow"},
-
- {"_Znwm", "__hipstdpar_operator_new"},
- {"_ZnwmRKSt9nothrow_t", "__hipstdpar_operator_new_nothrow"},
- {"_ZnwmSt11align_val_t", "__hipstdpar_operator_new_aligned"},
- {"_ZnwmSt11align_val_tRKSt9nothrow_t",
- "__hipstdpar_operator_new_aligned_nothrow"},
- {"__builtin_calloc", "__hipstdpar_calloc"},
- {"__builtin_free", "__hipstdpar_free"},
- {"__builtin_malloc", "__hipstdpar_malloc"},
- {"__builtin_operator_delete", "__hipstdpar_operator_delete"},
- {"__builtin_operator_new", "__hipstdpar_operator_new"},
- {"__builtin_realloc", "__hipstdpar_realloc"},
- {"__libc_calloc", "__hipstdpar_calloc"},
- {"__libc_free", "__hipstdpar_free"},
- {"__libc_malloc", "__hipstdpar_malloc"},
- {"__libc_memalign", "__hipstdpar_aligned_alloc"},
- {"__libc_realloc", "__hipstdpar_realloc"}
-};
+ {"aligned_alloc", "__hipstdpar_aligned_alloc"},
+ {"calloc", "__hipstdpar_calloc"},
+ {"free", "__hipstdpar_free"},
+ {"malloc", "__hipstdpar_malloc"},
+ {"memalign", "__hipstdpar_aligned_alloc"},
+ {"mmap", "__hipstdpar_mmap"},
+ {"munmap", "__hipstdpar_munmap"},
+ {"posix_memalign", "__hipstdpar_posix_aligned_alloc"},
+ {"realloc", "__hipstdpar_realloc"},
+ {"reallocarray", "__hipstdpar_realloc_array"},
+ {"_ZdaPv", "__hipstdpar_operator_delete"},
+ {"_ZdaPvm", "__hipstdpar_operator_delete_sized"},
+ {"_ZdaPvSt11align_val_t", "__hipstdpar_operator_delete_aligned"},
+ {"_ZdaPvmSt11align_val_t", "__hipstdpar_operator_delete_aligned_sized"},
+ {"_ZdlPv", "__hipstdpar_operator_delete"},
+ {"_ZdlPvm", "__hipstdpar_operator_delete_sized"},
+ {"_ZdlPvSt11align_val_t", "__hipstdpar_operator_delete_aligned"},
+ {"_ZdlPvmSt11align_val_t", "__hipstdpar_operator_delete_aligned_sized"},
+ {"_Znam", "__hipstdpar_operator_new"},
+ {"_ZnamRKSt9nothrow_t", "__hipstdpar_operator_new_nothrow"},
+ {"_ZnamSt11align_val_t", "__hipstdpar_operator_new_aligned"},
+ {"_ZnamSt11align_val_tRKSt9nothrow_t",
+ "__hipstdpar_operator_new_aligned_nothrow"},
+
+ {"_Znwm", "__hipstdpar_operator_new"},
+ {"_ZnwmRKSt9nothrow_t", "__hipstdpar_operator_new_nothrow"},
+ {"_ZnwmSt11align_val_t", "__hipstdpar_operator_new_aligned"},
+ {"_ZnwmSt11align_val_tRKSt9nothrow_t",
+ "__hipstdpar_operator_new_aligned_nothrow"},
+ {"__builtin_calloc", "__hipstdpar_calloc"},
+ {"__builtin_free", "__hipstdpar_free"},
+ {"__builtin_malloc", "__hipstdpar_malloc"},
+ {"__builtin_operator_delete", "__hipstdpar_operator_delete"},
+ {"__builtin_operator_new", "__hipstdpar_operator_new"},
+ {"__builtin_realloc", "__hipstdpar_realloc"},
+ {"__libc_calloc", "__hipstdpar_calloc"},
+ {"__libc_free", "__hipstdpar_free"},
+ {"__libc_malloc", "__hipstdpar_malloc"},
+ {"__libc_memalign", "__hipstdpar_aligned_alloc"},
+ {"__libc_realloc", "__hipstdpar_realloc"}};
static constexpr std::pair<StringLiteral, StringLiteral> HiddenMap[]{
- // hidden_malloc and hidden_free are only kept for backwards compatibility /
- // legacy purposes, and we should remove them in the future
- {"__hipstdpar_hidden_malloc", "__libc_malloc"},
- {"__hipstdpar_hidden_free", "__libc_free"},
- {"__hipstdpar_hidden_memalign", "__libc_memalign"},
- {"__hipstdpar_hidden_mmap", "mmap"},
- {"__hipstdpar_hidden_munmap", "munmap"}
-};
+ // hidden_malloc and hidden_free are only kept for backwards compatibility /
+ // legacy purposes, and we should remove them in the future
+ {"__hipstdpar_hidden_malloc", "__libc_malloc"},
+ {"__hipstdpar_hidden_free", "__libc_free"},
+ {"__hipstdpar_hidden_memalign", "__libc_memalign"},
+ {"__hipstdpar_hidden_mmap", "mmap"},
+ {"__hipstdpar_hidden_munmap", "munmap"}};
PreservedAnalyses
HipStdParAllocationInterpositionPass::run(Module &M, ModuleAnalysisManager&) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/138790
More information about the cfe-commits
mailing list