[polly] 880014b - [PPCGCodeGeneration] Avoid another pointer element type access
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 19 08:26:40 PDT 2022
Author: Nikita Popov
Date: 2022-04-19T17:26:33+02:00
New Revision: 880014b59343c8e8e5dc55f6324ce08fd37bd43c
URL: https://github.com/llvm/llvm-project/commit/880014b59343c8e8e5dc55f6324ce08fd37bd43c
DIFF: https://github.com/llvm/llvm-project/commit/880014b59343c8e8e5dc55f6324ce08fd37bd43c.diff
LOG: [PPCGCodeGeneration] Avoid another pointer element type access
Use an API that returns both the address and the element type,
and use that for the load type.
Added:
Modified:
polly/lib/CodeGen/PPCGCodeGeneration.cpp
Removed:
################################################################################
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index a734207bf5e77..c12e19c2895d7 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -1314,19 +1314,18 @@ void GPUNodeBuilder::createFor(__isl_take isl_ast_node *Node) {
void GPUNodeBuilder::createKernelCopy(ppcg_kernel_stmt *KernelStmt) {
isl_ast_expr *LocalIndex = isl_ast_expr_copy(KernelStmt->u.c.local_index);
- LocalIndex = isl_ast_expr_address_of(LocalIndex);
- Value *LocalAddr = ExprBuilder.create(LocalIndex);
+ auto LocalAddr = ExprBuilder.createAccessAddress(LocalIndex);
isl_ast_expr *Index = isl_ast_expr_copy(KernelStmt->u.c.index);
- Index = isl_ast_expr_address_of(Index);
- Value *GlobalAddr = ExprBuilder.create(Index);
- Type *IndexTy = GlobalAddr->getType()->getPointerElementType();
+ auto GlobalAddr = ExprBuilder.createAccessAddress(Index);
if (KernelStmt->u.c.read) {
- LoadInst *Load = Builder.CreateLoad(IndexTy, GlobalAddr, "shared.read");
- Builder.CreateStore(Load, LocalAddr);
+ LoadInst *Load =
+ Builder.CreateLoad(GlobalAddr.second, GlobalAddr.first, "shared.read");
+ Builder.CreateStore(Load, LocalAddr.first);
} else {
- LoadInst *Load = Builder.CreateLoad(IndexTy, LocalAddr, "shared.write");
- Builder.CreateStore(Load, GlobalAddr);
+ LoadInst *Load =
+ Builder.CreateLoad(LocalAddr.second, LocalAddr.first, "shared.write");
+ Builder.CreateStore(Load, GlobalAddr.first);
}
}
More information about the llvm-commits
mailing list