forked from OSchip/llvm-project
Fix Transforms/InstCombine/2006-03-30-ExtractElement.ll
llvm-svn: 27261
This commit is contained in:
parent
dab5696f84
commit
612fa8e6f3
|
@ -6704,9 +6704,13 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
|
||||||
if (IE->getOperand(2) == EI.getOperand(1))
|
if (IE->getOperand(2) == EI.getOperand(1))
|
||||||
return ReplaceInstUsesWith(EI, IE->getOperand(1));
|
return ReplaceInstUsesWith(EI, IE->getOperand(1));
|
||||||
// If the inserted and extracted elements are constants, they must not
|
// If the inserted and extracted elements are constants, they must not
|
||||||
// be the same value, replace with the pre-inserted value.
|
// be the same value, extract from the pre-inserted value instead.
|
||||||
if (isa<Constant>(IE->getOperand(2)) && isa<Constant>(EI.getOperand(1)))
|
if (isa<Constant>(IE->getOperand(2)) &&
|
||||||
return ReplaceInstUsesWith(EI, IE->getOperand(0));
|
isa<Constant>(EI.getOperand(1))) {
|
||||||
|
AddUsesToWorkList(EI);
|
||||||
|
EI.setOperand(0, IE->getOperand(0));
|
||||||
|
return &EI;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue