aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-12-09 01:17:24 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-12-09 01:17:24 +0000
commita711e2664a880bc4b941d2690371cf811167bf95 (patch)
tree926549a027f5a05536e9939ab66127a0a5f537a3 /lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parentd3caa135e4a12b56cf586dc4d2a3d89d821b2f46 (diff)
downloadexternal_llvm-a711e2664a880bc4b941d2690371cf811167bf95.zip
external_llvm-a711e2664a880bc4b941d2690371cf811167bf95.tar.gz
external_llvm-a711e2664a880bc4b941d2690371cf811167bf95.tar.bz2
Infer alignment for non-fixed stack object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90919 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 851e6c0..28e991b 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -5887,6 +5887,8 @@ unsigned SelectionDAG::InferPtrAlignment(SDValue Ptr) const {
if (FrameIdx != (1 << 31)) {
// FIXME: Handle FI+CST.
const MachineFrameInfo &MFI = *getMachineFunction().getFrameInfo();
+ unsigned FIInfoAlign = MinAlign(MFI.getObjectAlignment(FrameIdx),
+ FrameOffset);
if (MFI.isFixedObjectIndex(FrameIdx)) {
int64_t ObjectOffset = MFI.getObjectOffset(FrameIdx) + FrameOffset;
@@ -5899,13 +5901,12 @@ unsigned SelectionDAG::InferPtrAlignment(SDValue Ptr) const {
// Finally, the frame object itself may have a known alignment. Factor
// the alignment + offset into a new alignment. For example, if we know
- // the FI is 8 byte aligned, but the pointer is 4 off, we really have a
+ // the FI is 8 byte aligned, but the pointer is 4 off, we really have a
// 4-byte alignment of the resultant pointer. Likewise align 4 + 4-byte
// offset = 4-byte alignment, align 4 + 1-byte offset = align 1, etc.
- unsigned FIInfoAlign = MinAlign(MFI.getObjectAlignment(FrameIdx),
- FrameOffset);
return std::max(Align, FIInfoAlign);
}
+ return FIInfoAlign;
}
return 0;