forked from OSchip/llvm-project
Fix a bug where we would 'promote' an allocation from one type to another
where the second has less alignment required. If we had explicit alignment support in the IR, we could handle this case, but we can't until we do. llvm-svn: 23960
This commit is contained in:
parent
ac87beb03a
commit
355ecc09f8
|
@ -3796,6 +3796,10 @@ Instruction *InstCombiner::PromoteCastOfAllocation(CastInst &CI,
|
||||||
const Type *CastElTy = PTy->getElementType();
|
const Type *CastElTy = PTy->getElementType();
|
||||||
if (!AllocElTy->isSized() || !CastElTy->isSized()) return 0;
|
if (!AllocElTy->isSized() || !CastElTy->isSized()) return 0;
|
||||||
|
|
||||||
|
unsigned AllocElTyAlign = TD->getTypeSize(AllocElTy);
|
||||||
|
unsigned CastElTyAlign = TD->getTypeSize(CastElTy);
|
||||||
|
if (CastElTyAlign < AllocElTyAlign) return 0;
|
||||||
|
|
||||||
uint64_t AllocElTySize = TD->getTypeSize(AllocElTy);
|
uint64_t AllocElTySize = TD->getTypeSize(AllocElTy);
|
||||||
uint64_t CastElTySize = TD->getTypeSize(CastElTy);
|
uint64_t CastElTySize = TD->getTypeSize(CastElTy);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue