[clang] [llvm] [NVPTX] Change the alloca address space in NVPTXLowerAlloca (PR #154814)
Alex MacLean via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 22 09:55:29 PDT 2025
================
@@ -51,86 +59,66 @@ char NVPTXLowerAlloca::ID = 1;
INITIALIZE_PASS(NVPTXLowerAlloca, "nvptx-lower-alloca", "Lower Alloca", false,
false)
-// =============================================================================
-// Main function for this pass.
-// =============================================================================
-bool NVPTXLowerAlloca::runOnFunction(Function &F) {
- if (skipFunction(F))
- return false;
+bool NVPTXLowerAlloca::runOnModule(Module &M) {
+ bool Changed = changeDataLayout(M);
+ for (auto &F : M)
+ Changed |= lowerFunctionAllocas(F);
+ return Changed;
+}
- bool Changed = false;
+bool NVPTXLowerAlloca::lowerFunctionAllocas(Function &F) {
+ SmallVector<AllocaInst *, 16> Allocas;
for (auto &BB : F)
- for (auto &I : BB) {
- if (auto allocaInst = dyn_cast<AllocaInst>(&I)) {
- Changed = true;
+ for (auto &I : BB)
----------------
AlexMaclean wrote:
Nit: use `instructions(F)`
https://github.com/llvm/llvm-project/pull/154814
More information about the llvm-commits
mailing list