[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Oct 23 23:26:29 PDT 2005
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.390 -> 1.391
---
Log message:
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.
---
Diffs of the changes: (+6 -2)
InstructionCombining.cpp | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.390 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.391
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.390 Mon Oct 24 01:22:12 2005
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Oct 24 01:26:18 2005
@@ -3795,10 +3795,14 @@
const Type *AllocElTy = AI.getAllocatedType();
const Type *CastElTy = PTy->getElementType();
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 CastElTySize = TD->getTypeSize(CastElTy);
-
+
// If the allocation is for an even multiple of the cast type size
if (CastElTySize == 0 || AllocElTySize % CastElTySize != 0)
return 0;
More information about the llvm-commits
mailing list