[llvm-commits] [llvm] r90919 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Evan Cheng evan.cheng at apple.com
Tue Dec 8 17:17:24 PST 2009


Author: evancheng
Date: Tue Dec  8 19:17:24 2009
New Revision: 90919

URL: http://llvm.org/viewvc/llvm-project?rev=90919&view=rev
Log:
Infer alignment for non-fixed stack object.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=90919&r1=90918&r2=90919&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Dec  8 19:17:24 2009
@@ -5887,6 +5887,8 @@
   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 @@
 
       // 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;





More information about the llvm-commits mailing list