diff options
author | Sanjay Patel <spatel@rotateright.com> | 2020-01-17 08:31:16 -0500 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2020-01-17 08:31:16 -0500 |
commit | c1e159ef6eb0095b78d08594f02f511c69d9a64b (patch) | |
tree | f021d49f9715fdd3a4cba9fe7c73f579d0c5357c /llvm/lib/IR/Constants.cpp | |
parent | ffd3e1607db232c362fa5ad40e5cf2afa400b304 (diff) | |
download | llvm-c1e159ef6eb0095b78d08594f02f511c69d9a64b.zip llvm-c1e159ef6eb0095b78d08594f02f511c69d9a64b.tar.gz llvm-c1e159ef6eb0095b78d08594f02f511c69d9a64b.tar.bz2 |
[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.
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 93d406f..79c3028 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -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 { |