summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
diff options
context:
space:
mode:
authorHao Liu <Hao.Liu@arm.com>2014-01-08 03:06:15 +0000
committerHao Liu <Hao.Liu@arm.com>2014-01-08 03:06:15 +0000
commit26abebbb2c786b504e3bcb2892d0a5515fc3156f (patch)
tree3906869597bd20e062c3b0e766457855be1ebe6e /llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
parentaf76481caff471a3d7bcfc9814a4281fa6a1c31b (diff)
downloadbcm5719-llvm-26abebbb2c786b504e3bcb2892d0a5515fc3156f.tar.gz
bcm5719-llvm-26abebbb2c786b504e3bcb2892d0a5515fc3156f.zip
Fix a bug about generating undef operand when optimising shuffle vector and insert element in instruction combine.
llvm-svn: 198730
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index 1e724106991..c0b9b2fc3e5 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -763,9 +763,10 @@ InstCombiner::EvaluateInDifferentElementOrder(Value *V, ArrayRef<int> Mask) {
}
}
+ // If element is not in Mask, no need to handle the operand 1 (element to
+ // be inserted). Just evaluate values in operand 0 according to Mask.
if (!Found)
- return UndefValue::get(
- VectorType::get(V->getType()->getScalarType(), Mask.size()));
+ return EvaluateInDifferentElementOrder(I->getOperand(0), Mask);
Value *V = EvaluateInDifferentElementOrder(I->getOperand(0), Mask);
return InsertElementInst::Create(V, I->getOperand(1),
OpenPOWER on IntegriCloud