diff options
author | Lauro Ramos Venancio <lauro.venancio@gmail.com> | 2007-07-31 20:13:21 +0000 |
---|---|---|
committer | Lauro Ramos Venancio <lauro.venancio@gmail.com> | 2007-07-31 20:13:21 +0000 |
commit | c7d1114ade08821746f448a6b6e9507da807022d (patch) | |
tree | a8b15ebf255867ff0cdf902f6520c2523d671c32 /lib/Transforms | |
parent | b1576f56c8e8ec7afb49e4af77f7f5871f1b52ec (diff) |
Fix a bug in GetKnownAlignment of packed structs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40649 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 06a6749375..a7e817a8e6 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -7533,11 +7533,13 @@ static unsigned GetKnownAlignment(Value *V, TargetData *TD) { const Type *BasePtrTy = GEPI->getOperand(0)->getType(); const PointerType *PtrTy = cast<PointerType>(BasePtrTy); - if (TD->getABITypeAlignment(PtrTy->getElementType()) - <= BaseAlignment) { + unsigned Align = TD->getABITypeAlignment(PtrTy->getElementType()); + if (Align <= BaseAlignment) { const Type *GEPTy = GEPI->getType(); const PointerType *GEPPtrTy = cast<PointerType>(GEPTy); - return TD->getABITypeAlignment(GEPPtrTy->getElementType()); + Align = std::min(Align, (unsigned) + TD->getABITypeAlignment(GEPPtrTy->getElementType())); + return Align; } return 0; } |