@@ -1314,19 +1314,18 @@ void GPUNodeBuilder::createFor(__isl_take isl_ast_node *Node) {
1314
1314
1315
1315
void GPUNodeBuilder::createKernelCopy (ppcg_kernel_stmt *KernelStmt) {
1316
1316
isl_ast_expr *LocalIndex = isl_ast_expr_copy (KernelStmt->u .c .local_index );
1317
- LocalIndex = isl_ast_expr_address_of (LocalIndex);
1318
- Value *LocalAddr = ExprBuilder.create (LocalIndex);
1317
+ auto LocalAddr = ExprBuilder.createAccessAddress (LocalIndex);
1319
1318
isl_ast_expr *Index = isl_ast_expr_copy (KernelStmt->u .c .index );
1320
- Index = isl_ast_expr_address_of (Index);
1321
- Value *GlobalAddr = ExprBuilder.create (Index);
1322
- Type *IndexTy = GlobalAddr->getType ()->getPointerElementType ();
1319
+ auto GlobalAddr = ExprBuilder.createAccessAddress (Index);
1323
1320
1324
1321
if (KernelStmt->u .c .read ) {
1325
- LoadInst *Load = Builder.CreateLoad (IndexTy, GlobalAddr, " shared.read" );
1326
- Builder.CreateStore (Load, LocalAddr);
1322
+ LoadInst *Load =
1323
+ Builder.CreateLoad (GlobalAddr.second , GlobalAddr.first , " shared.read" );
1324
+ Builder.CreateStore (Load, LocalAddr.first );
1327
1325
} else {
1328
- LoadInst *Load = Builder.CreateLoad (IndexTy, LocalAddr, " shared.write" );
1329
- Builder.CreateStore (Load, GlobalAddr);
1326
+ LoadInst *Load =
1327
+ Builder.CreateLoad (LocalAddr.second , LocalAddr.first , " shared.write" );
1328
+ Builder.CreateStore (Load, GlobalAddr.first );
1330
1329
}
1331
1330
}
1332
1331
0 commit comments