mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-07 11:51:13 +00:00
[IR] fix Constant::isElementWiseEqual() to allow for all undef elements compare
We could argue that match() should be more flexible here, but I'm not sure what impact that would have on existing code.
This commit is contained in:
parent
5e10616d04
commit
b77facd730
@ -296,7 +296,8 @@ bool Constant::isElementWiseEqual(Value *Y) const {
|
||||
Type *IntTy = VectorType::getInteger(cast<VectorType>(Ty));
|
||||
Constant *C0 = ConstantExpr::getBitCast(const_cast<Constant *>(this), IntTy);
|
||||
Constant *C1 = ConstantExpr::getBitCast(cast<Constant>(Y), IntTy);
|
||||
return match(ConstantExpr::getICmp(ICmpInst::ICMP_EQ, C0, C1), m_One());
|
||||
Constant *CmpEq = ConstantExpr::getICmp(ICmpInst::ICMP_EQ, C0, C1);
|
||||
return isa<UndefValue>(CmpEq) || match(CmpEq, m_One());
|
||||
}
|
||||
|
||||
bool Constant::containsUndefElement() const {
|
||||
|
@ -620,7 +620,7 @@ TEST(ConstantsTest, isElementWiseEqual) {
|
||||
|
||||
EXPECT_TRUE(CF1211->isElementWiseEqual(CF12U1));
|
||||
EXPECT_TRUE(CF12U1->isElementWiseEqual(CF1211));
|
||||
EXPECT_FALSE(CFUU1U->isElementWiseEqual(CF12U1)); // FIXME - all lanes compare as undef
|
||||
EXPECT_TRUE(CFUU1U->isElementWiseEqual(CF12U1));
|
||||
EXPECT_FALSE(CF12U2->isElementWiseEqual(CF12U1));
|
||||
EXPECT_FALSE(CF12U1->isElementWiseEqual(CF12U2));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user