summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
authorNadav Rotem <nadav.rotem@intel.com>2012-02-28 11:54:05 +0000
committerNadav Rotem <nadav.rotem@intel.com>2012-02-28 11:54:05 +0000
commit875e463b19755f2d32ca6166febd06f216e94058 (patch)
tree49884dcb85e5fb2665f000fe4e2a2eb3609b5af7 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
parentf54f60f3cee6d07fb1bc41321e3d54a7e3011773 (diff)
downloadbcm5719-llvm-875e463b19755f2d32ca6166febd06f216e94058.tar.gz
bcm5719-llvm-875e463b19755f2d32ca6166febd06f216e94058.zip
Fix a bug in the code that builds SDNodes from vector GEPs.
When the GEP index is a vector of pointers, the code that calculated the size of the element started from the vector type, and not the contained pointer type. As a result, instead of looking at the data element pointed by the vector, this code used the size of the vector. This works for 32bit members (on 32bit systems), but not for other types. Added code to peel the vector type and added a test. llvm-svn: 151626
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index ca64c903f39..5eba2c3ea7c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -3078,6 +3078,10 @@ void SelectionDAGBuilder::visitExtractValue(const ExtractValueInst &I) {
void SelectionDAGBuilder::visitGetElementPtr(const User &I) {
SDValue N = getValue(I.getOperand(0));
Type *Ty = I.getOperand(0)->getType();
+ // If this is a vector of pointers, use the size of the
+ // vector element and not the size of the pointer.
+ if (VectorType *VTy = dyn_cast<VectorType>(Ty))
+ Ty = VTy->getElementType();
for (GetElementPtrInst::const_op_iterator OI = I.op_begin()+1, E = I.op_end();
OI != E; ++OI) {
OpenPOWER on IntegriCloud