summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2013-03-28 01:28:02 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2013-03-28 01:28:02 +0000
commit99866dd535fbeaeb3108768362592bff4259456a (patch)
treef5ef6f0fb3df73a83b169d874228bd7a85de42ce /llvm/lib/Transforms
parent4e4d9b3abf2bdf2ba8f992664eedcca0bda6ce00 (diff)
downloadbcm5719-llvm-99866dd535fbeaeb3108768362592bff4259456a.tar.gz
bcm5719-llvm-99866dd535fbeaeb3108768362592bff4259456a.zip
Check if Type is a vector before calling function Type::getVectorNumElements.
llvm-svn: 178208
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index a262d711d3b..121aa1f8d73 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -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.
OpenPOWER on IntegriCloud