|
1 | 1 | // Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 | + |
2 | 3 | #include <Python.h> |
3 | 4 |
|
4 | 5 | #include <gtest/gtest.h> |
|
21 | 22 | using namespace jit; |
22 | 23 | using namespace jit::hir; |
23 | 24 |
|
| 25 | +HIRPrinter fullPrinter() { |
| 26 | + return HIRPrinter{}.setFullSnapshots(true); |
| 27 | +} |
| 28 | + |
24 | 29 | TEST(BasicBlockTest, CanAppendInstrs) { |
25 | 30 | Environment env; |
26 | 31 | BasicBlock block; |
@@ -630,7 +635,7 @@ TEST_F(HIRBuildTest, GetLength) { |
630 | 635 | } |
631 | 636 | )"; |
632 | 637 | #endif |
633 | | - EXPECT_EQ(HIRPrinter(true).ToString(*(irfunc)), expected); |
| 638 | + EXPECT_EQ(fullPrinter().ToString(*(irfunc)), expected); |
634 | 639 | } |
635 | 640 |
|
636 | 641 | TEST_F(HIRBuildTest, LoadAssertionError) { |
@@ -692,7 +697,7 @@ TEST_F(HIRBuildTest, LoadAssertionError) { |
692 | 697 | } |
693 | 698 | )"; |
694 | 699 | #endif |
695 | | - EXPECT_EQ(HIRPrinter(true).ToString(*(irfunc)), expected); |
| 700 | + EXPECT_EQ(fullPrinter().ToString(*(irfunc)), expected); |
696 | 701 | } |
697 | 702 |
|
698 | 703 | TEST_F(HIRBuildTest, SetUpdate) { |
@@ -835,7 +840,7 @@ TEST_F(HIRBuildTest, SetUpdate) { |
835 | 840 | } |
836 | 841 | )"; |
837 | 842 | #endif |
838 | | - EXPECT_EQ(HIRPrinter(true).ToString(*(irfunc)), expected); |
| 843 | + EXPECT_EQ(fullPrinter().ToString(*(irfunc)), expected); |
839 | 844 | } |
840 | 845 |
|
841 | 846 | class EdgeCaseTest : public RuntimeTest {}; |
@@ -921,7 +926,7 @@ TEST_F(EdgeCaseTest, IgnoreUnreachableLoops) { |
921 | 926 | } |
922 | 927 | )"; |
923 | 928 | #endif |
924 | | - EXPECT_EQ(HIRPrinter(true).ToString(*(irfunc)), expected); |
| 929 | + EXPECT_EQ(fullPrinter().ToString(*(irfunc)), expected); |
925 | 930 | } |
926 | 931 |
|
927 | 932 | TEST_F(EdgeCaseTest, JumpBackwardNoInterrupt) { |
@@ -1006,7 +1011,7 @@ TEST_F(EdgeCaseTest, JumpBackwardNoInterrupt) { |
1006 | 1011 | } |
1007 | 1012 | )"; |
1008 | 1013 | #endif |
1009 | | - EXPECT_EQ(HIRPrinter(true).ToString(*(irfunc)), expected); |
| 1014 | + EXPECT_EQ(fullPrinter().ToString(*(irfunc)), expected); |
1010 | 1015 | } |
1011 | 1016 |
|
1012 | 1017 | class CppInlinerTest : public RuntimeTest {}; |
@@ -1171,7 +1176,7 @@ TEST_F(HIRCloneTest, CanCloneDeoptBase) { |
1171 | 1176 | } |
1172 | 1177 | } |
1173 | 1178 | )"; |
1174 | | - ASSERT_EQ(HIRPrinter(true).ToString(*irfunc), expected); |
| 1179 | + ASSERT_EQ(fullPrinter().ToString(*irfunc), expected); |
1175 | 1180 | BasicBlock* bb0 = irfunc->cfg.entry_block; |
1176 | 1181 | Instr& load_global = *(++(bb0->rbegin())); |
1177 | 1182 | ASSERT_TRUE(load_global.IsLoadGlobal()); |
@@ -1295,7 +1300,7 @@ TEST_F(HIRBuildTest, ROT_N) { |
1295 | 1300 | } |
1296 | 1301 | )"; |
1297 | 1302 |
|
1298 | | - EXPECT_EQ(HIRPrinter(true).ToString(*(irfunc)), expected); |
| 1303 | + EXPECT_EQ(fullPrinter().ToString(*(irfunc)), expected); |
1299 | 1304 | } |
1300 | 1305 | #endif |
1301 | 1306 |
|
@@ -1383,7 +1388,7 @@ TEST_F(HIRBuildTest, MatchMapping) { |
1383 | 1388 | } |
1384 | 1389 | )"; |
1385 | 1390 | #endif |
1386 | | - EXPECT_EQ(HIRPrinter(true).ToString(*(irfunc)), expected); |
| 1391 | + EXPECT_EQ(fullPrinter().ToString(*(irfunc)), expected); |
1387 | 1392 | } |
1388 | 1393 |
|
1389 | 1394 | TEST_F(HIRBuildTest, MatchSequence) { |
@@ -1470,7 +1475,7 @@ TEST_F(HIRBuildTest, MatchSequence) { |
1470 | 1475 | } |
1471 | 1476 | )"; |
1472 | 1477 | #endif |
1473 | | - EXPECT_EQ(HIRPrinter(true).ToString(*(irfunc)), expected); |
| 1478 | + EXPECT_EQ(fullPrinter().ToString(*(irfunc)), expected); |
1474 | 1479 | } |
1475 | 1480 |
|
1476 | 1481 | TEST_F(HIRBuildTest, MatchKeys) { |
@@ -1580,7 +1585,7 @@ TEST_F(HIRBuildTest, MatchKeys) { |
1580 | 1585 | } |
1581 | 1586 | )"; |
1582 | 1587 | #endif |
1583 | | - EXPECT_EQ(HIRPrinter(true).ToString(*(irfunc)), expected); |
| 1588 | + EXPECT_EQ(fullPrinter().ToString(*(irfunc)), expected); |
1584 | 1589 | } |
1585 | 1590 |
|
1586 | 1591 | TEST_F(HIRBuildTest, ListExtend) { |
@@ -1650,7 +1655,7 @@ TEST_F(HIRBuildTest, ListExtend) { |
1650 | 1655 | } |
1651 | 1656 | )"; |
1652 | 1657 | #endif |
1653 | | - EXPECT_EQ(HIRPrinter(true).ToString(*(irfunc)), expected); |
| 1658 | + EXPECT_EQ(fullPrinter().ToString(*(irfunc)), expected); |
1654 | 1659 | } |
1655 | 1660 |
|
1656 | 1661 | TEST_F(HIRBuildTest, ListToTuple) { |
@@ -1717,7 +1722,7 @@ TEST_F(HIRBuildTest, ListToTuple) { |
1717 | 1722 | } |
1718 | 1723 | )"; |
1719 | 1724 | #endif |
1720 | | - EXPECT_EQ(HIRPrinter(true).ToString(*(irfunc)), expected); |
| 1725 | + EXPECT_EQ(fullPrinter().ToString(*(irfunc)), expected); |
1721 | 1726 | } |
1722 | 1727 |
|
1723 | 1728 | TEST_F(HIRBuildTest, LoadFastAndClear) { |
@@ -1749,6 +1754,6 @@ TEST_F(HIRBuildTest, LoadFastAndClear) { |
1749 | 1754 | } |
1750 | 1755 | )"; |
1751 | 1756 |
|
1752 | | - EXPECT_EQ(HIRPrinter(true).ToString(*(irfunc)), expected); |
| 1757 | + EXPECT_EQ(fullPrinter().ToString(*(irfunc)), expected); |
1753 | 1758 | #endif |
1754 | 1759 | } |
0 commit comments