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

Duncan Sands baldrick at free.fr
Thu Jul 10 08:26:17 PDT 2008


Author: baldrick
Date: Thu Jul 10 10:26:17 2008
New Revision: 53404

URL: http://llvm.org/viewvc/llvm-project?rev=53404&view=rev
Log:
Make sure the alignment of the temporary created
in CreateStackStoreLoad is good enough for both
the source and destination types.

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

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

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Thu Jul 10 10:26:17 2008
@@ -16,6 +16,7 @@
 #include "LegalizeTypes.h"
 #include "llvm/CallingConv.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Target/TargetData.h"
 using namespace llvm;
 
 #ifndef NDEBUG
@@ -547,8 +548,11 @@
 
 SDOperand DAGTypeLegalizer::CreateStackStoreLoad(SDOperand Op,
                                                  MVT DestVT) {
-  // Create the stack frame object.
-  SDOperand FIPtr = DAG.CreateStackTemporary(DestVT);
+  // Create the stack frame object.  Make sure it is aligned for both
+  // the source and destination types.
+  unsigned SrcAlign =
+   TLI.getTargetData()->getPrefTypeAlignment(Op.getValueType().getTypeForMVT());
+  SDOperand FIPtr = DAG.CreateStackTemporary(DestVT, SrcAlign);
 
   // Emit a store to the stack slot.
   SDOperand Store = DAG.getStore(DAG.getEntryNode(), Op, FIPtr, NULL, 0);





More information about the llvm-commits mailing list