[PATCH] D72784: [IR] fix crash in Constant::isElementWiseEqual() with FP types
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 14:34:12 PST 2020
spatel marked an inline comment as done.
spatel added inline comments.
================
Comment at: llvm/lib/IR/Constants.cpp:290
// They may still be identical element-wise (if they have `undef`s).
- // FIXME: This crashes on FP vector constants.
- return match(ConstantExpr::getICmp(ICmpInst::Predicate::ICMP_EQ,
- const_cast<Constant *>(this),
- cast<Constant>(Y)),
- m_One());
+ // Bitcast to integer to allow exact bitwise comparison for all types.
+ Type *IntTy = VectorType::getInteger(cast<VectorType>(Ty));
----------------
nikic wrote:
> Probably not going to work for vectors of pointers though. Is that relevant to your use-case?
Yes, good catch. It was not my immediate concern, and I'm not sure how to handle pointers. So I think it's ok to just bail out on those. I'll add to the tests though.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72784/new/
https://reviews.llvm.org/D72784
More information about the llvm-commits
mailing list