summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff options
context:
space:
mode:
authorMon P Wang <wangmp@apple.com>2008-07-02 17:07:12 +0000
committerMon P Wang <wangmp@apple.com>2008-07-02 17:07:12 +0000
commit4b7c1acf26b85bda27e73c497fedf6a47c9d1824 (patch)
treeb38092b7b23aa2b112768a1042c40fd5a6ce219e /llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
parent6b2c4f6143bea4a28e5a8816842d79d7b11b382c (diff)
downloadbcm5719-llvm-4b7c1acf26b85bda27e73c497fedf6a47c9d1824.tar.gz
bcm5719-llvm-4b7c1acf26b85bda27e73c497fedf6a47c9d1824.zip
Fixed problem in EmitStackConvert where the source and target type
have different alignment by creating a stack slot with the max alignment of source and target type. llvm-svn: 53031
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 78e640f46b8..196b2fcfb45 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -4872,35 +4872,41 @@ SDOperand SelectionDAGLegalize::EmitStackConvert(SDOperand SrcOp,
MVT SlotVT,
MVT DestVT) {
// Create the stack frame object.
- SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT);
-
+ unsigned SrcAlign = TLI.getTargetData()->getPrefTypeAlignment(
+ SrcOp.getValueType().getTypeForMVT());
+ SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT, SrcAlign);
+
FrameIndexSDNode *StackPtrFI = cast<FrameIndexSDNode>(FIPtr);
int SPFI = StackPtrFI->getIndex();
-
+
unsigned SrcSize = SrcOp.getValueType().getSizeInBits();
unsigned SlotSize = SlotVT.getSizeInBits();
unsigned DestSize = DestVT.getSizeInBits();
+ const Type* SlotTy = SlotVT.getTypeForMVT();
+ unsigned SlotAlign = TLI.getTargetData()->getPrefTypeAlignment(SlotTy);
// Emit a store to the stack slot. Use a truncstore if the input value is
// later than DestVT.
SDOperand Store;
+
if (SrcSize > SlotSize)
Store = DAG.getTruncStore(DAG.getEntryNode(), SrcOp, FIPtr,
- PseudoSourceValue::getFixedStack(),
- SPFI, SlotVT);
+ PseudoSourceValue::getFixedStack(), SPFI, SlotVT,
+ false, SlotAlign);
else {
assert(SrcSize == SlotSize && "Invalid store");
Store = DAG.getStore(DAG.getEntryNode(), SrcOp, FIPtr,
- PseudoSourceValue::getFixedStack(),
- SPFI);
+ PseudoSourceValue::getFixedStack(), SPFI,
+ false, SlotAlign);
}
// Result is a load from the stack slot.
if (SlotSize == DestSize)
- return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0);
+ return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0, false, SlotAlign);
assert(SlotSize < DestSize && "Unknown extension!");
- return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, SlotVT);
+ return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, SlotVT,
+ false, SlotAlign);
}
SDOperand SelectionDAGLegalize::ExpandSCALAR_TO_VECTOR(SDNode *Node) {
OpenPOWER on IntegriCloud