diff options
author | Chris Lattner <sabre@nondot.org> | 2006-10-01 19:40:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-10-01 19:40:58 +0000 |
commit | e831b9a48bcf6f136044f1aed509eee3dee7d9d4 (patch) | |
tree | 8b818d3b0fda3fa42231fd209cfda8bf1ec94b95 | |
parent | 537cf962d1133bcb7fdfee09eb6e00145db37274 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30682 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 19051fa2e1..9bfd66afb2 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -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 |