[PATCH] D89038: [PatternMatch] Add new FP matchers. NFC.

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 07:01:32 PDT 2020


foad marked an inline comment as done.
foad added inline comments.


================
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())) {
----------------
lebedev.ri wrote:
> Note that this is implicitly `/*AllowUndefs=*/false`
Right, so there is a pre-existing problem with matchers like this one, which claim to allow undef, but in fact the second (binding) form of the matcher does not:

```
/// Match an integer or vector of negative values.
/// For vectors, this includes constants with undefined elements.
inline cst_pred_ty<is_negative> m_Negative() {
  return cst_pred_ty<is_negative>();
}
inline api_pred_ty<is_negative> m_Negative(const APInt *&V) {
  return V;
}
```


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