[PATCH] D89038: [PatternMatch] Add new FP matchers. NFC.
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 22 03:07:34 PDT 2020
lebedev.ri added inline comments.
================
Comment at: llvm/include/llvm/IR/PatternMatch.h:338-340
+/// This helper class is used to match scalar and vector constants that
+/// satisfy a specified predicate, and bind them to an APFloat.
+template <typename Predicate> struct apf_pred_ty : public Predicate {
----------------
This should probably mention whether or not `undef` vector constants are allowed.
================
Comment at: llvm/include/llvm/IR/PatternMatch.h:353
+ if (const auto *C = dyn_cast<Constant>(V))
+ if (auto *CI = dyn_cast_or_null<ConstantFP>(C->getSplatValue()))
+ if (this->isValue(CI->getValue())) {
----------------
Note that this is implicitly `/*AllowUndefs=*/false`
================
Comment at: llvm/include/llvm/IR/PatternMatch.h:587
+/// Match a non-NaN FP constant.
+/// For vectors, this includes constants with undefined elements.
+inline cstfp_pred_ty<is_nonnan> m_NonNaN() {
----------------
I think i'd like to see some dedicated tests with `undef`s in `llvm/unittest/IR/PatternMatch.cpp`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89038/new/
https://reviews.llvm.org/D89038
More information about the llvm-commits
mailing list