diff options
author | Nadav Rotem <nadav.rotem@intel.com> | 2012-06-07 20:28:57 +0000 |
---|---|---|
committer | Nadav Rotem <nadav.rotem@intel.com> | 2012-06-07 20:28:57 +0000 |
commit | 4e50efead611a59e808f7744132c3ad1576cc404 (patch) | |
tree | 34f1d69ebd325bf6107e1a57ce60187ddcb82dc5 /llvm/lib/Transforms | |
parent | a7dcc996a980d29fa7fb7536d0f3f48e572b1ca9 (diff) | |
download | bcm5719-llvm-4e50efead611a59e808f7744132c3ad1576cc404.tar.gz bcm5719-llvm-4e50efead611a59e808f7744132c3ad1576cc404.zip |
Fix a bug in FoldSelectOpOp. Bitcast ops may change the number of vector elements, which may disagree with the select condition type.
llvm-svn: 158166
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index 0ae00ea17a8..eb9945b6817 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -129,6 +129,12 @@ Instruction *InstCombiner::FoldSelectOpOp(SelectInst &SI, Instruction *TI, if (TI->isCast()) { if (TI->getOperand(0)->getType() != FI->getOperand(0)->getType()) 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()) + return 0; } else { return 0; // unknown unary op. } |