[llvm] [IR][PatternMatch] Make `m_Checked{Int,Fp}` accept `Constant *` output instead of `APInt *` (PR #91377)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 17:29:01 PDT 2024


================
@@ -625,39 +625,49 @@ TEST_F(PatternMatchTest, CheckedInt) {
     APInt APVal(8, Val);
     Constant *C = ConstantInt::get(I8Ty, Val);
 
+    CRes = nullptr;
     Res = nullptr;
     EXPECT_TRUE(m_CheckedInt(CheckTrue).match(C));
-    EXPECT_TRUE(m_CheckedInt(Res, CheckTrue).match(C));
+    EXPECT_TRUE(m_CheckedInt(CRes, CheckTrue).match(C));
+    EXPECT_NE(CRes, nullptr);
+    EXPECT_TRUE(match(CRes, m_APIntAllowPoison(Res)));
----------------
nikic wrote:

```suggestion
    EXPECT_EQ(CRes, C);
```
I think we should be checking the constant directly, not the APInt it contains.

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


More information about the llvm-commits mailing list