[polly] ee6bd28 - [PPCGCodeGeneration] Avoid pointer element type access
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 19 08:09:41 PDT 2022
Author: Nikita Popov
Date: 2022-04-19T17:09:34+02:00
New Revision: ee6bd28f233f330b34d0a83453eeaf56b0cc87ee
URL: https://github.com/llvm/llvm-project/commit/ee6bd28f233f330b34d0a83453eeaf56b0cc87ee
DIFF: https://github.com/llvm/llvm-project/commit/ee6bd28f233f330b34d0a83453eeaf56b0cc87ee.diff
LOG: [PPCGCodeGeneration] Avoid pointer element type access
Pass through the ArrayTy instead.
Added:
Modified:
polly/lib/CodeGen/PPCGCodeGeneration.cpp
Removed:
################################################################################
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index bd5674d499024..a734207bf5e77 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -486,12 +486,13 @@ class GPUNodeBuilder : public IslNodeBuilder {
/// Store a specific kernel launch parameter in the array of kernel launch
/// parameters.
///
+ /// @param ArrayTy Array type of \p Parameters.
/// @param Parameters The list of parameters in which to store.
/// @param Param The kernel launch parameter to store.
/// @param Index The index in the parameter list, at which to store the
/// parameter.
- void insertStoreParameter(Instruction *Parameters, Instruction *Param,
- int Index);
+ void insertStoreParameter(Type *ArrayTy, Instruction *Parameters,
+ Instruction *Param, int Index);
/// Create kernel launch parameters.
///
@@ -1625,11 +1626,11 @@ GPUNodeBuilder::getBlockSizes(ppcg_kernel *Kernel) {
return std::make_tuple(Sizes[0], Sizes[1], Sizes[2]);
}
-void GPUNodeBuilder::insertStoreParameter(Instruction *Parameters,
+void GPUNodeBuilder::insertStoreParameter(Type *ArrayTy,
+ Instruction *Parameters,
Instruction *Param, int Index) {
Value *Slot = Builder.CreateGEP(
- Parameters->getType()->getPointerElementType(), Parameters,
- {Builder.getInt64(0), Builder.getInt64(Index)});
+ ArrayTy, Parameters, {Builder.getInt64(0), Builder.getInt64(Index)});
Value *ParamTyped = Builder.CreatePointerCast(Param, Builder.getInt8PtrTy());
Builder.CreateStore(ParamTyped, Slot);
}
@@ -1730,7 +1731,7 @@ GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Function *F,
Launch + "_param_" + std::to_string(Index),
EntryBlock->getTerminator());
Builder.CreateStore(Val, Param);
- insertStoreParameter(Parameters, Param, Index);
+ insertStoreParameter(ArrayTy, Parameters, Param, Index);
Index++;
}
@@ -1751,7 +1752,7 @@ GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Function *F,
Launch + "_param_" + std::to_string(Index),
EntryBlock->getTerminator());
Builder.CreateStore(Val, Param);
- insertStoreParameter(Parameters, Param, Index);
+ insertStoreParameter(ArrayTy, Parameters, Param, Index);
Index++;
}
@@ -1764,7 +1765,7 @@ GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Function *F,
Launch + "_param_" + std::to_string(Index),
EntryBlock->getTerminator());
Builder.CreateStore(Val, Param);
- insertStoreParameter(Parameters, Param, Index);
+ insertStoreParameter(ArrayTy, Parameters, Param, Index);
Index++;
}
@@ -1776,7 +1777,7 @@ GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Function *F,
Launch + "_param_size_" + std::to_string(i),
EntryBlock->getTerminator());
Builder.CreateStore(Val, Param);
- insertStoreParameter(Parameters, Param, Index);
+ insertStoreParameter(ArrayTy, Parameters, Param, Index);
Index++;
}
}
More information about the llvm-commits
mailing list