mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
extractelement(undef,x) -> undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27300 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c741ea424a
commit
1f13c88939
@ -6655,12 +6655,14 @@ static bool CheapToScalarize(Value *V, bool isConstant) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
|
Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
|
||||||
if (ConstantAggregateZero *C =
|
// If packed val is undef, replace extract with scalar undef.
|
||||||
dyn_cast<ConstantAggregateZero>(EI.getOperand(0))) {
|
if (isa<UndefValue>(EI.getOperand(0)))
|
||||||
// If packed val is constant 0, replace extract with scalar 0
|
return ReplaceInstUsesWith(EI, UndefValue::get(EI.getType()));
|
||||||
const Type *Ty = cast<PackedType>(C->getType())->getElementType();
|
|
||||||
return ReplaceInstUsesWith(EI, Constant::getNullValue(Ty));
|
// If packed val is constant 0, replace extract with scalar 0.
|
||||||
}
|
if (isa<ConstantAggregateZero>(EI.getOperand(0)))
|
||||||
|
return ReplaceInstUsesWith(EI, Constant::getNullValue(EI.getType()));
|
||||||
|
|
||||||
if (ConstantPacked *C = dyn_cast<ConstantPacked>(EI.getOperand(0))) {
|
if (ConstantPacked *C = dyn_cast<ConstantPacked>(EI.getOperand(0))) {
|
||||||
// If packed val is constant with uniform operands, replace EI
|
// If packed val is constant with uniform operands, replace EI
|
||||||
// with that operand
|
// with that operand
|
||||||
|
Loading…
Reference in New Issue
Block a user