auto *Cond = Select->getCondition();
auto *TVal = Select->getTrueValue();
auto *FVal = Select->getFalseValue();
+
+ // Don't match a scalar select of bool vectors.
+ // Transforms expect a single type for operands if this matches.
+ if (Cond->getType() != Select->getType())
+ return false;
+
if (Opcode == Instruction::And) {
auto *C = dyn_cast<Constant>(FVal);
if (C && C->isNullValue())
// select i1 Scalar, <3 x i1> <i1 1, i1 1, i1 1>, <3 x i1> Vector
Value *MixedTypeOr = IRB.CreateSelect(Scalar, T, Vector);
+ // We allow matching a real vector logical select,
+ // but not a scalar select of vector bools.
EXPECT_TRUE(match(VecAnd, m_LogicalAnd(m_Value(), m_Value())));
- EXPECT_TRUE(match(MixedTypeAnd, m_LogicalAnd(m_Value(), m_Value())));
+ EXPECT_FALSE(match(MixedTypeAnd, m_LogicalAnd(m_Value(), m_Value())));
EXPECT_TRUE(match(VecOr, m_LogicalOr(m_Value(), m_Value())));
- EXPECT_TRUE(match(MixedTypeOr, m_LogicalOr(m_Value(), m_Value())));
+ EXPECT_FALSE(match(MixedTypeOr, m_LogicalOr(m_Value(), m_Value())));
}
TEST_F(PatternMatchTest, VScale) {