mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-24 13:18:17 +00:00
[InstCombine] Some cleanup in optimization of redundant insertvalue instructions.
And one more test added. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208355 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user