mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 18:24:23 +00:00
Check if Type is a vector before calling function Type::getVectorNumElements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178208 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -127,13 +127,14 @@ Instruction *InstCombiner::FoldSelectOpOp(SelectInst &SI, Instruction *TI,
|
||||
// If this is a non-volatile load or a cast from the same type,
|
||||
// merge.
|
||||
if (TI->isCast()) {
|
||||
if (TI->getOperand(0)->getType() != FI->getOperand(0)->getType())
|
||||
Type *FIOpndTy = FI->getOperand(0)->getType();
|
||||
if (TI->getOperand(0)->getType() != FIOpndTy)
|
||||
return 0;
|
||||
// The select condition may be a vector. We may only change the operand
|
||||
// type if the vector width remains the same (and matches the condition).
|
||||
Type *CondTy = SI.getCondition()->getType();
|
||||
if (CondTy->isVectorTy() && CondTy->getVectorNumElements() !=
|
||||
FI->getOperand(0)->getType()->getVectorNumElements())
|
||||
if (CondTy->isVectorTy() && (!FIOpndTy->isVectorTy() ||
|
||||
CondTy->getVectorNumElements() != FIOpndTy->getVectorNumElements()))
|
||||
return 0;
|
||||
} else {
|
||||
return 0; // unknown unary op.
|
||||
|
Reference in New Issue
Block a user