summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
diff options
context:
space:
mode:
authorMichael Zolotukhin <mzolotukhin@apple.com>2014-05-08 19:50:24 +0000
committerMichael Zolotukhin <mzolotukhin@apple.com>2014-05-08 19:50:24 +0000
commit292d3caa1528d3ed5ac056241dff9f57243aea11 (patch)
tree1ece83504beccbed9f5a636386829961b08ab472 /llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
parent6f657c46e99528ab0146205c8f7028e6c679cd84 (diff)
downloadbcm5719-llvm-292d3caa1528d3ed5ac056241dff9f57243aea11.tar.gz
bcm5719-llvm-292d3caa1528d3ed5ac056241dff9f57243aea11.zip
[InstCombine] Some cleanup in optimization of redundant insertvalue instructions.
And one more test added. llvm-svn: 208355
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index 80c20b70758..b072b4d422d 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -506,13 +506,12 @@ Instruction *InstCombiner::visitInsertValueInst(InsertValueInst &I) {
// chain), check if any of the 'children' uses the same indices as the first
// instruction. In this case, the first one is redundant.
Value *V = &I;
- unsigned int Depth = 0;
+ unsigned Depth = 0;
while (V->hasOneUse() && Depth < 10) {
User *U = V->user_back();
- InsertValueInst *UserInsInst = dyn_cast<InsertValueInst>(U);
- if (!UserInsInst || U->getType() != I.getType()) {
+ auto UserInsInst = dyn_cast<InsertValueInst>(U);
+ if (!UserInsInst || U->getOperand(0) != V)
break;
- }
if (UserInsInst->getIndices() == FirstIndices) {
IsRedundant = true;
break;
OpenPOWER on IntegriCloud