aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2010-11-03 20:44:42 +0000
committerEric Christopher <echristo@apple.com>2010-11-03 20:44:42 +0000
commitd81f17acb4f2d755759a4d8a83a71a98ade0edd3 (patch)
treed13ea2947493e4fcf4e6cdcfa1c645d499deb388 /lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent964bc25e5a03be208427ce2ebadb22a42681ef9c (diff)
downloadexternal_llvm-d81f17acb4f2d755759a4d8a83a71a98ade0edd3.zip
external_llvm-d81f17acb4f2d755759a4d8a83a71a98ade0edd3.tar.gz
external_llvm-d81f17acb4f2d755759a4d8a83a71a98ade0edd3.tar.bz2
Just return undef for invalid masks or elts, and since we're doing that,
just do it earlier too. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118195 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index c31598e..7154d9d 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -6242,6 +6242,10 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
if (!LN0 || !LN0->hasOneUse() || LN0->isVolatile())
return SDValue();
+ // If Idx was -1 above, Elt is going to be -1, so just return undef.
+ if (Elt == -1)
+ return DAG.getUNDEF(LN0->getBasePtr().getValueType());
+
unsigned Align = LN0->getAlignment();
if (NewLoad) {
// Check the resultant load doesn't need a higher alignment than the
@@ -6257,11 +6261,8 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
SDValue NewPtr = LN0->getBasePtr();
unsigned PtrOff = 0;
- // 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) {
+
+ if (Elt) {
PtrOff = LVT.getSizeInBits() * Elt / 8;
EVT PtrType = NewPtr.getValueType();
if (TLI.isBigEndian())