1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Preserve SourceValue information when lowering produces multiple loads from

different offsets within the same stack slot.

llvm-svn: 61093
This commit is contained in:
Dan Gohman 2008-12-16 18:25:36 +00:00
parent 96d87db03b
commit f8f5625748

View File

@ -19,6 +19,7 @@
#include "LegalizeTypes.h" #include "LegalizeTypes.h"
#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetData.h"
#include "llvm/CodeGen/PseudoSourceValue.h"
using namespace llvm; using namespace llvm;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@ -83,12 +84,14 @@ void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, SDValue &Lo,
unsigned Alignment = unsigned Alignment =
TLI.getTargetData()->getPrefTypeAlignment(NOutVT.getTypeForMVT()); TLI.getTargetData()->getPrefTypeAlignment(NOutVT.getTypeForMVT());
SDValue StackPtr = DAG.CreateStackTemporary(InVT, Alignment); SDValue StackPtr = DAG.CreateStackTemporary(InVT, Alignment);
int SPFI = cast<FrameIndexSDNode>(StackPtr.getNode())->getIndex();
const Value *SV = PseudoSourceValue::getFixedStack(SPFI);
// Emit a store to the stack slot. // Emit a store to the stack slot.
SDValue Store = DAG.getStore(DAG.getEntryNode(), InOp, StackPtr, NULL, 0); SDValue Store = DAG.getStore(DAG.getEntryNode(), InOp, StackPtr, SV, 0);
// Load the first half from the stack slot. // Load the first half from the stack slot.
Lo = DAG.getLoad(NOutVT, Store, StackPtr, NULL, 0); Lo = DAG.getLoad(NOutVT, Store, StackPtr, SV, 0);
// Increment the pointer to the other half. // Increment the pointer to the other half.
unsigned IncrementSize = NOutVT.getSizeInBits() / 8; unsigned IncrementSize = NOutVT.getSizeInBits() / 8;
@ -96,7 +99,7 @@ void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, SDValue &Lo,
DAG.getIntPtrConstant(IncrementSize)); DAG.getIntPtrConstant(IncrementSize));
// Load the second half from the stack slot. // Load the second half from the stack slot.
Hi = DAG.getLoad(NOutVT, Store, StackPtr, NULL, 0, false, Hi = DAG.getLoad(NOutVT, Store, StackPtr, SV, IncrementSize, false,
MinAlign(Alignment, IncrementSize)); MinAlign(Alignment, IncrementSize));
// Handle endianness of the load. // Handle endianness of the load.