aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeTypes.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeTypes.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
index ed09c6b712..7a0a52d97d 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
@@ -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::BitConvertToInteger(SDOperand Op) {
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);