summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2010-11-03 09:36:40 +0000
committerEric Christopher <echristo@apple.com>2010-11-03 09:36:40 +0000
commitfcc9e6848afee4c98658b1f4afe8ff2396e84975 (patch)
treedacfd5afb9557edb2074292335fceaccda3e7bc4 /llvm/lib/CodeGen/SelectionDAG
parent8eb254aed60f8d08d38fbf8306a760309c7404cd (diff)
downloadbcm5719-llvm-fcc9e6848afee4c98658b1f4afe8ff2396e84975.tar.gz
bcm5719-llvm-fcc9e6848afee4c98658b1f4afe8ff2396e84975.zip
If we have an undef mask our Elt will be -1 for our access, handle
this by using an undef as a pointer. Fixes rdar://8625016 llvm-svn: 118164
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 10aa36cf1a3..c31598e6a7a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -6190,7 +6190,7 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
SDValue EltNo = N->getOperand(1);
if (isa<ConstantSDNode>(EltNo)) {
- unsigned Elt = cast<ConstantSDNode>(EltNo)->getZExtValue();
+ int Elt = cast<ConstantSDNode>(EltNo)->getZExtValue();
bool NewLoad = false;
bool BCNumEltsChanged = false;
EVT VT = InVec.getValueType();
@@ -6228,7 +6228,7 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
// Select the input vector, guarding against out of range extract vector.
unsigned NumElems = VT.getVectorNumElements();
- int Idx = (Elt > NumElems) ? -1 : SVN->getMaskElt(Elt);
+ int Idx = (Elt > (int)NumElems) ? -1 : SVN->getMaskElt(Elt);
InVec = (Idx < (int)NumElems) ? InVec.getOperand(0) : InVec.getOperand(1);
if (InVec.getOpcode() == ISD::BIT_CONVERT)
@@ -6257,7 +6257,11 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
SDValue NewPtr = LN0->getBasePtr();
unsigned PtrOff = 0;
- if (Elt) {
+ // If Idx was -1 above, Elt is going to be -1, so just use undef as our
+ // new pointer.
+ if (Elt == -1) {
+ NewPtr = DAG.getUNDEF(NewPtr.getValueType());
+ } else if (Elt) {
PtrOff = LVT.getSizeInBits() * Elt / 8;
EVT PtrType = NewPtr.getValueType();
if (TLI.isBigEndian())
OpenPOWER on IntegriCloud