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

This commit is contained in:
Eli Friedman 2021-07-18 13:50:07 -07:00
parent 68fa6f7c7c
commit 43705149ed
1 changed files with 4 additions and 5 deletions

View File

@ -278,8 +278,8 @@ Value *BlockGenerator::generateLocationAccessed(
// the newly generated pointer. // the newly generated pointer.
auto OldPtrTy = ExpectedType->getPointerTo(); auto OldPtrTy = ExpectedType->getPointerTo();
auto NewPtrTy = Address->getType(); auto NewPtrTy = Address->getType();
OldPtrTy = PointerType::get(OldPtrTy->getElementType(), OldPtrTy = PointerType::getWithSamePointeeType(
NewPtrTy->getPointerAddressSpace()); OldPtrTy, NewPtrTy->getPointerAddressSpace());
if (OldPtrTy != NewPtrTy) if (OldPtrTy != NewPtrTy)
Address = Builder.CreateBitOrPointerCast(Address, OldPtrTy); Address = Builder.CreateBitOrPointerCast(Address, OldPtrTy);
@ -801,9 +801,8 @@ void BlockGenerator::generateScalarStores(
// The new Val might have a different type than the old Val due to // The new Val might have a different type than the old Val due to
// ScalarEvolution looking through bitcasts. // ScalarEvolution looking through bitcasts.
if (Val->getType() != Address->getType()->getPointerElementType()) Address = Builder.CreateBitOrPointerCast(
Address = Builder.CreateBitOrPointerCast( Address, Val->getType()->getPointerTo());
Address, Val->getType()->getPointerTo());
Builder.CreateStore(Val, Address); Builder.CreateStore(Val, Address);
}); });