[PATCH] D72784: [IR] fix crash in Constant::isElementWiseEqual() with FP types

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 13:47:44 PST 2020


nikic 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));
----------------
Probably not going to work for vectors of pointers though. Is that relevant to your use-case?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72784/new/

https://reviews.llvm.org/D72784





More information about the llvm-commits mailing list