diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-12-09 01:17:24 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-12-09 01:17:24 +0000 |
commit | 2d412f0cb861a843d747b7da63553a5232644b39 (patch) | |
tree | b5537700a7486601433b9a61f96328b0bb4dcff9 | |
parent | 1750009f38f9e2df7544deb0a60c8c5a238841f3 (diff) | |
download | bcm5719-llvm-2d412f0cb861a843d747b7da63553a5232644b39.tar.gz bcm5719-llvm-2d412f0cb861a843d747b7da63553a5232644b39.zip |
Infer alignment for non-fixed stack object.
llvm-svn: 90919
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 851e6c040ea..28e991bf843 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/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; |