Skip to content

Commit 6819992

Browse files
yoneymeta-codesync[bot]
authored andcommitted
Add free-threaded expectation for postgen cast test
Summary: Add free-threaded LIR output for PostgenJITRTCastTest. Reviewed By: alexmalyshev Differential Revision: D114746204 fbshipit-source-id: e3c1170c2e21459c06e2c5b2c741b5304d118b2d
1 parent 5faa3c3 commit 6819992

1 file changed

Lines changed: 64 additions & 2 deletions

File tree

cinderx/RuntimeTests/backend_test.cpp

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,66 @@ TEST_F(BackendTest, PostgenJITRTCastTest) {
13311331
post_gen.run();
13321332

13331333
// Check that caller LIR is as expected.
1334+
#ifdef Py_GIL_DISABLED
1335+
auto expected_caller = fmt::format(
1336+
R"(Function:
1337+
BB %0 - succs: %8
1338+
%1:Object = Bind {0}:Object
1339+
%2:Object = Bind {1}:Object
1340+
1341+
BB %8 - preds: %0 - succs: %10 %9
1342+
%29:Object = Move %1:Object
1343+
%30:ObjectUntagged = And %29:Object, 18446744073709551614(0xfffffffffffffffe):64bit
1344+
%15:Object = Move [%30:ObjectUntagged + 0x18]:Object
1345+
%31:Object = Move %15:Object
1346+
%32:ObjectUntagged = And %31:Object, 18446744073709551614(0xfffffffffffffffe):64bit
1347+
%33:Object = Move %2:Object
1348+
%34:ObjectUntagged = And %33:Object, 18446744073709551614(0xfffffffffffffffe):64bit
1349+
%16:Object = Equal %32:ObjectUntagged, %34:ObjectUntagged
1350+
CondBranch %16:Object
1351+
1352+
BB %9 - preds: %8 - succs: %10 %11
1353+
%35:Object = Move %15:Object
1354+
%36:ObjectUntagged = And %35:Object, 18446744073709551614(0xfffffffffffffffe):64bit
1355+
%37:Object = Move %2:Object
1356+
%38:ObjectUntagged = And %37:Object, 18446744073709551614(0xfffffffffffffffe):64bit
1357+
%18:Object = Call {2}({2:#x}):Object, %36:ObjectUntagged, %38:ObjectUntagged
1358+
CondBranch %18:Object
1359+
1360+
BB %11 - preds: %9 - succs: %12
1361+
%39:Object = Move %15:Object
1362+
%40:ObjectUntagged = And %39:Object, 18446744073709551614(0xfffffffffffffffe):64bit
1363+
%22:Object = Move [%40:ObjectUntagged + 0x28]:Object
1364+
%41:Object = Move %2:Object
1365+
%42:ObjectUntagged = And %41:Object, 18446744073709551614(0xfffffffffffffffe):64bit
1366+
%23:Object = Move [%42:ObjectUntagged + 0x28]:Object
1367+
%43:Object = Move %23:Object
1368+
%44:ObjectUntagged = And %43:Object, 18446744073709551614(0xfffffffffffffffe):64bit
1369+
%45:Object = Move %22:Object
1370+
%46:ObjectUntagged = And %45:Object, 18446744073709551614(0xfffffffffffffffe):64bit
1371+
Call {3}({3:#x}):Object, {4}({4:#x}):Object, string_literal, %44:ObjectUntagged, %46:ObjectUntagged
1372+
%25:Object = Move 0(0x0):Object
1373+
1374+
BB %10 - preds: %8 %9 - succs: %12
1375+
1376+
BB %12 - preds: %10 %11 - succs: %7
1377+
%28:Object = Phi (BB%10, %1:Object), (BB%11, %25:Object)
1378+
1379+
BB %7 - preds: %12 - succs: %6
1380+
%3:Object = Move %28:Object
1381+
{5:>16} = Move %3:Object
1382+
Return
1383+
1384+
BB %6 - preds: %7
1385+
1386+
)",
1387+
ARGUMENT_REGS[0],
1388+
ARGUMENT_REGS[1],
1389+
reinterpret_cast<uint64_t>(PyType_IsSubtype),
1390+
reinterpret_cast<uint64_t>(PyErr_Format),
1391+
reinterpret_cast<uint64_t>(PyExc_TypeError),
1392+
fmt::format("{}:Object", arch::reg_general_return_loc.toString()));
1393+
#else
13341394
auto expected_caller = fmt::format(
13351395
R"(Function:
13361396
BB %0 - succs: %8
@@ -1375,13 +1435,15 @@ BB %6 - preds: %7
13751435
reinterpret_cast<uint64_t>(PyErr_Format),
13761436
reinterpret_cast<uint64_t>(PyExc_TypeError),
13771437
fmt::format("{}:Object", arch::reg_general_return_loc.toString()));
1438+
#endif
13781439
std::stringstream ss;
13791440
caller->sortBasicBlocks();
13801441
ss << *caller;
13811442
// Replace the string literal address
1382-
std::regex reg(R"(\d+\(0x[0-9a-fA-F]+\):Object, %23:Object, %22:Object)");
1443+
std::regex reg(
1444+
R"((Call \d+\(0x[0-9a-fA-F]+\):Object, \d+\(0x[0-9a-fA-F]+\):Object, )\d+\(0x[0-9a-fA-F]+\):Object, (%[0-9]+:Object[A-Za-z]*), (%[0-9]+:Object[A-Za-z]*))");
13831445
std::string caller_str =
1384-
regex_replace(ss.str(), reg, "string_literal, %23:Object, %22:Object");
1446+
regex_replace(ss.str(), reg, "$1string_literal, $2, $3");
13851447
ASSERT_EQ(expected_caller, caller_str);
13861448
}
13871449

0 commit comments

Comments
 (0)