[polly] ee423d9 - [polly] Remove uses of PointerType::getElementType()

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 01:23:45 PST 2022


Author: Nikita Popov
Date: 2022-02-14T10:23:36+01:00
New Revision: ee423d93ead39e94c2970b3cc7ef6e6faa75d10b

URL: https://github.com/llvm/llvm-project/commit/ee423d93ead39e94c2970b3cc7ef6e6faa75d10b
DIFF: https://github.com/llvm/llvm-project/commit/ee423d93ead39e94c2970b3cc7ef6e6faa75d10b.diff

LOG: [polly] Remove uses of PointerType::getElementType()

This method has been removed. I missed these uses in conditionally-
compiled code previously.

Added: 
    

Modified: 
    polly/lib/CodeGen/ManagedMemoryRewrite.cpp
    polly/lib/CodeGen/PPCGCodeGeneration.cpp

Removed: 
    


################################################################################
diff  --git a/polly/lib/CodeGen/ManagedMemoryRewrite.cpp b/polly/lib/CodeGen/ManagedMemoryRewrite.cpp
index 35456388e56b..449a4b54ba2a 100644
--- a/polly/lib/CodeGen/ManagedMemoryRewrite.cpp
+++ b/polly/lib/CodeGen/ManagedMemoryRewrite.cpp
@@ -180,7 +180,7 @@ static void
 replaceGlobalArray(Module &M, const DataLayout &DL, GlobalVariable &Array,
                    SmallPtrSet<GlobalVariable *, 4> &ReplacedGlobals) {
   // We only want arrays.
-  ArrayType *ArrayTy = dyn_cast<ArrayType>(Array.getType()->getElementType());
+  ArrayType *ArrayTy = dyn_cast<ArrayType>(Array.getValueType());
   if (!ArrayTy)
     return;
   Type *ElemTy = ArrayTy->getElementType();
@@ -298,8 +298,7 @@ static void rewriteAllocaAsManagedMemory(AllocaInst *Alloca,
 
   Function *MallocManagedFn =
       getOrCreatePollyMallocManaged(*Alloca->getModule());
-  const uint64_t Size =
-      DL.getTypeAllocSize(Alloca->getType()->getElementType());
+  const uint64_t Size = DL.getTypeAllocSize(Alloca->getAllocatedType());
   Value *SizeVal = Builder.getInt64(Size);
   Value *RawManagedMem = Builder.CreateCall(MallocManagedFn, {SizeVal});
   Value *Bitcasted = Builder.CreateBitCast(RawManagedMem, Alloca->getType());

diff  --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index a10a5312b60d..bd5674d49902 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -1318,7 +1318,7 @@ void GPUNodeBuilder::createKernelCopy(ppcg_kernel_stmt *KernelStmt) {
   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 = cast<PointerType>(GlobalAddr->getType())->getElementType();
+  Type *IndexTy = GlobalAddr->getType()->getPointerElementType();
 
   if (KernelStmt->u.c.read) {
     LoadInst *Load = Builder.CreateLoad(IndexTy, GlobalAddr, "shared.read");
@@ -3445,7 +3445,7 @@ class PPCGCodeGeneration : public ScopPass {
       for (Value *Op : Inst.operands())
         // Look for (<func-type>*) among operands of Inst
         if (auto PtrTy = dyn_cast<PointerType>(Op->getType())) {
-          if (isa<FunctionType>(PtrTy->getElementType())) {
+          if (isa<FunctionType>(PtrTy->getPointerElementType())) {
             LLVM_DEBUG(dbgs()
                        << Inst << " has illegal use of function in kernel.\n");
             return true;


        


More information about the llvm-commits mailing list