[polly] 4370514 - [polly] Get rid of a couple uses of PointerType::getElementType().

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 18 13:52:05 PDT 2021


Author: Eli Friedman
Date: 2021-07-18T13:51:38-07:00
New Revision: 43705149ed8ed1047a5b07706cc7b44ce29e9323

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

LOG: [polly] Get rid of a couple uses of PointerType::getElementType().

Added: 
    

Modified: 
    polly/lib/CodeGen/BlockGenerators.cpp

Removed: 
    


################################################################################
diff  --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index 14e85e0feb23e..946bc09b359ed 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -278,8 +278,8 @@ Value *BlockGenerator::generateLocationAccessed(
     // the newly generated pointer.
     auto OldPtrTy = ExpectedType->getPointerTo();
     auto NewPtrTy = Address->getType();
-    OldPtrTy = PointerType::get(OldPtrTy->getElementType(),
-                                NewPtrTy->getPointerAddressSpace());
+    OldPtrTy = PointerType::getWithSamePointeeType(
+        OldPtrTy, NewPtrTy->getPointerAddressSpace());
 
     if (OldPtrTy != NewPtrTy)
       Address = Builder.CreateBitOrPointerCast(Address, OldPtrTy);
@@ -801,9 +801,8 @@ void BlockGenerator::generateScalarStores(
 
           // The new Val might have a 
diff erent type than the old Val due to
           // ScalarEvolution looking through bitcasts.
-          if (Val->getType() != Address->getType()->getPointerElementType())
-            Address = Builder.CreateBitOrPointerCast(
-                Address, Val->getType()->getPointerTo());
+          Address = Builder.CreateBitOrPointerCast(
+              Address, Val->getType()->getPointerTo());
 
           Builder.CreateStore(Val, Address);
         });


        


More information about the llvm-commits mailing list