diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-09-06 18:34:38 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-09-06 18:34:38 +0000 |
commit | 69156b4c20249e7800cc09e0eef0beb3d15ac1ad (patch) | |
tree | 461d3cf041290f4a99740d540bf0973d6084f98e /lib/Analysis/InstructionSimplify.cpp | |
parent | ee8648bdac07986a0f1ec897b02ec82a2f144d46 (diff) |
Diffstat (limited to 'lib/Analysis/InstructionSimplify.cpp')
-rw-r--r-- | lib/Analysis/InstructionSimplify.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp index fa42b48b6cdb..a7f8f5c8c99b 100644 --- a/lib/Analysis/InstructionSimplify.cpp +++ b/lib/Analysis/InstructionSimplify.cpp @@ -3574,18 +3574,9 @@ static Value *SimplifyExtractElementInst(Value *Vec, Value *Idx, const Query &, // If extracting a specified index from the vector, see if we can recursively // find a previously computed scalar that was inserted into the vector. - if (auto *IdxC = dyn_cast<ConstantInt>(Idx)) { - unsigned IndexVal = IdxC->getZExtValue(); - unsigned VectorWidth = Vec->getType()->getVectorNumElements(); - - // If this is extracting an invalid index, turn this into undef, to avoid - // crashing the code below. - if (IndexVal >= VectorWidth) - return UndefValue::get(Vec->getType()->getVectorElementType()); - - if (Value *Elt = findScalarElement(Vec, IndexVal)) + if (auto *IdxC = dyn_cast<ConstantInt>(Idx)) + if (Value *Elt = findScalarElement(Vec, IdxC->getZExtValue())) return Elt; - } return nullptr; } |