aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-02-25 15:20:39 +0000
committerDan Gohman <gohman@apple.com>2010-02-25 15:20:39 +0000
commitaa9d854b334cab2f29ca6d95413a0946b8a38429 (patch)
treecea0953c05223188ec4fb31bfc0a915b83c2b5b1 /lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
parent9a49f1552db7e2ce24a03ec068b17db8a238856d (diff)
downloadexternal_llvm-aa9d854b334cab2f29ca6d95413a0946b8a38429.tar.gz
external_llvm-aa9d854b334cab2f29ca6d95413a0946b8a38429.tar.bz2
external_llvm-aa9d854b334cab2f29ca6d95413a0946b8a38429.zip
Revert r97064. Duncan pointed out that bitcasts are defined in
terms of store and load, which means bitcasting between scalar integer and vector has endian-specific results, which undermines this whole approach. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97137 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 87dc0ac935..e9321dad8c 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -660,8 +660,7 @@ PerformInsertVectorEltInMemory(SDValue Vec, SDValue Val, SDValue Idx,
unsigned CastOpc = IdxVT.bitsGT(PtrVT) ? ISD::TRUNCATE : ISD::ZERO_EXTEND;
Tmp3 = DAG.getNode(CastOpc, dl, PtrVT, Tmp3);
// Add the offset to the index.
- unsigned EltSize = TLI.getTargetData()->
- getTypeAllocSize(EltVT.getTypeForEVT(*DAG.getContext()));
+ unsigned EltSize = EltVT.getSizeInBits()/8;
Tmp3 = DAG.getNode(ISD::MUL, dl, IdxVT, Tmp3,DAG.getConstant(EltSize, IdxVT));
SDValue StackPtr2 = DAG.getNode(ISD::ADD, dl, IdxVT, Tmp3, StackPtr);
// Store the scalar value.
@@ -1513,9 +1512,8 @@ SDValue SelectionDAGLegalize::ExpandExtractFromVectorThroughStack(SDValue Op) {
false, false, 0);
// Add the offset to the index.
- unsigned EltSize = TLI.getTargetData()->getTypeAllocSize(
- Vec.getValueType().getVectorElementType().getTypeForEVT(*DAG.getContext()));
-
+ unsigned EltSize =
+ Vec.getValueType().getVectorElementType().getSizeInBits()/8;
Idx = DAG.getNode(ISD::MUL, dl, Idx.getValueType(), Idx,
DAG.getConstant(EltSize, Idx.getValueType()));
@@ -1550,8 +1548,7 @@ SDValue SelectionDAGLegalize::ExpandVectorBuildThroughStack(SDNode* Node) {
// Emit a store of each element to the stack slot.
SmallVector<SDValue, 8> Stores;
- unsigned TypeByteSize = TLI.getTargetData()->
- getTypeAllocSize(EltVT.getTypeForEVT(*DAG.getContext()));
+ unsigned TypeByteSize = EltVT.getSizeInBits() / 8;
// Store (in the right endianness) the elements to memory.
for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) {
// Ignore undef elements.