Fix a bug from r1.391 of this file, where we checked the size instead of

the alignment when promoting allocations.  This implements
InstCombine/cast.ll:test32

llvm-svn: 30682
This commit is contained in:
Chris Lattner 2006-10-01 19:40:58 +00:00
parent c82477f3a8
commit 7d19067c42
1 changed files with 2 additions and 2 deletions

View File

@ -5053,8 +5053,8 @@ Instruction *InstCombiner::PromoteCastOfAllocation(CastInst &CI,
const Type *CastElTy = PTy->getElementType();
if (!AllocElTy->isSized() || !CastElTy->isSized()) return 0;
unsigned AllocElTyAlign = TD->getTypeSize(AllocElTy);
unsigned CastElTyAlign = TD->getTypeSize(CastElTy);
unsigned AllocElTyAlign = TD->getTypeAlignment(AllocElTy);
unsigned CastElTyAlign = TD->getTypeAlignment(CastElTy);
if (CastElTyAlign < AllocElTyAlign) return 0;
// If the allocation has multiple uses, only promote it if we are strictly