[llvm-commits] Setting alignment when creating temporary patch

Mon P Wang monping at apple.com
Sat Jul 12 18:41:23 PDT 2008


Hi,

I looked at uses of CreateStackTemporary to see if there were any  
other possible issues with alignment like in EmitStackConvert.  The  
only case that I saw was the case of a BIT_CONVERT when the convert  
from a scalar or a vector to a vector.

   -- Mon Ping


--- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp    (revision 53520)
+++ lib/CodeGen/SelectionDAG/LegalizeDAG.cpp    (working copy)
@@ -5464,7 +5464,6 @@
                                                       MVT DestVT) {
    if (Op0.getValueType() == MVT::i32) {
      // simple 32-bit [signed|unsigned] integer to float/double  
expansion
-
      // Get the stack frame index of a 8 byte buffer.
      SDOperand StackSlot = DAG.CreateStackTemporary(MVT::f64);

@@ -7015,7 +7014,9 @@
        // The input is a scalar or single-element vector.
        // Lower to a store/load so that it can be split.
        // FIXME: this could be improved probably.
-      SDOperand Ptr = DAG.CreateStackTemporary(InOp.getValueType());
+      unsigned LdAlign = TLI.getTargetData()->getPrefTypeAlignment(
+                                             
Op.getValueType().getTypeForMVT());
+      SDOperand Ptr = DAG.CreateStackTemporary(InOp.getValueType(),  
LdAlign);
        int FI = cast<FrameIndexSDNode>(Ptr.Val)->getIndex();

        SDOperand St = DAG.getStore(DAG.getEntryNode(),




More information about the llvm-commits mailing list