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 | 549e775e67a2257ada472b4bb976882edc0b6a7a (patch) | |
| tree | c7d2e5f87b79ec221eb4378584f7caf0b769b683 /llvm/lib | |
| parent | 54ec4bfa5f5fb11a21a10edbe2788fe816b40911 (diff) | |
| download | bcm5719-llvm-549e775e67a2257ada472b4bb976882edc0b6a7a.tar.gz bcm5719-llvm-549e775e67a2257ada472b4bb976882edc0b6a7a.zip | |
Fix a bug in GetKnownAlignment of packed structs.
llvm-svn: 40649
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 06a67493750..a7e817a8e65 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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; } |

