[llvm] [DAG] Added m_AnyBinOp and m_c_AnyBinOp in SDPatternMatch.h (PR #86435)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 09:50:11 PDT 2024


================
@@ -152,6 +152,24 @@ TEST_F(SelectionDAGPatternMatchTest, matchBinaryOp) {
       sd_match(SFAdd, m_ChainedBinOp(ISD::STRICT_FADD, m_SpecificVT(Float32VT),
                                      m_SpecificVT(Float32VT))));
 
+  EXPECT_TRUE(sd_match(And, m_AnyBinOp(ISD::AND, m_Value(), m_Value())));
----------------
mshockwave wrote:

Have you ran this test? Because I'm a little surprised this test can be built and passed since the signature of `AnyBinaryOp_match::match` doesn't conform to what `sd_match` expects.
In case you don't know how to run a unit test, try `ninja check-llvm-unit`. Another way for people lacks patience like me is to explicitly build unit test via `ninja UnitTests` and run only the test in this file via
```
./unittests/CodeGen/CodeGenTests --gtest_filter='SelectionDAGPatternMatchTest.*'
```
(`--gtest_filter` comes from google test, which we use for unit testing)

https://github.com/llvm/llvm-project/pull/86435


More information about the llvm-commits mailing list