summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-07-07 19:56:21 +0000
committerCraig Topper <craig.topper@intel.com>2017-07-07 19:56:21 +0000
commit5a06c2264b2096224dc0786e2e6d33f2378c3b4c (patch)
treef7aaab5d64eb25cde22620373161c4a0b52bface
parent2c4018064e55ae16ae515e07d163063eda92fa62 (diff)
downloadbcm5719-llvm-5a06c2264b2096224dc0786e2e6d33f2378c3b4c.tar.gz
bcm5719-llvm-5a06c2264b2096224dc0786e2e6d33f2378c3b4c.zip
[PatternMatch] Implement m_AnyZero using Constant::isZeroValue instead of ORing together isNullValue and isNegativeZeroValue. NFCI
llvm-svn: 307432
-rw-r--r--llvm/include/llvm/IR/PatternMatch.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/include/llvm/IR/PatternMatch.h b/llvm/include/llvm/IR/PatternMatch.h
index 3d15f9d0bb0..4b03063a6a9 100644
--- a/llvm/include/llvm/IR/PatternMatch.h
+++ b/llvm/include/llvm/IR/PatternMatch.h
@@ -158,12 +158,18 @@ struct match_neg_zero {
/// zero
inline match_neg_zero m_NegZero() { return match_neg_zero(); }
+struct match_any_zero {
+ template <typename ITy> bool match(ITy *V) {
+ if (const auto *C = dyn_cast<Constant>(V))
+ return C->isZeroValue();
+ return false;
+ }
+};
+
/// \brief - Match an arbitrary zero/null constant. This includes
/// zero_initializer for vectors and ConstantPointerNull for pointers. For
/// floating point constants, this will match negative zero and positive zero
-inline match_combine_or<match_zero, match_neg_zero> m_AnyZero() {
- return m_CombineOr(m_Zero(), m_NegZero());
-}
+inline match_any_zero m_AnyZero() { return match_any_zero(); }
struct match_nan {
template <typename ITy> bool match(ITy *V) {
@@ -195,7 +201,7 @@ struct match_all_ones {
}
};
-/// \brief Match an integer 1 or a vector with all elements equal to 1.
+/// \brief Match an integer or vector with all bits set to true.
inline match_all_ones m_AllOnes() { return match_all_ones(); }
struct apint_match {
OpenPOWER on IntegriCloud