Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: don't inline control ops of Switch or GotoNth nodes if it would result in additional copies in destructured SSA #130

Merged
merged 3 commits into from
Mar 15, 2024

Conversation

daniel-makerx
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Mar 15, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/puya
   __main__.py31197%116
   arc4_util.py134894%30, 78–79, 91, 103, 105, 173, 200
   arc32.py126398%103, 114, 220
   client_gen.py1071070%1–195
   compile.py158398%138, 152–155
   errors.py1222976%47–48, 52, 54–57, 82, 124, 144–145, 150–164, 175–178
   logging_config.py1292878%15, 36–39, 45, 47, 50–54, 69, 88, 141–143, 146–148, 150, 163–172, 194
   models.py80396%10–13
   options.py30293%12–13
   parse.py2031891%85, 97, 126, 165, 168, 222, 265, 275, 277, 281, 309–314, 318, 348, 362, 374–375
   utils.py1501987%51, 55, 89, 95, 110, 113–115, 122, 144, 157–158, 162, 166–169, 198, 200, 223
src/puya/awst
   function_traverser.py188398%113, 143–144
   nodes.py9696793%19–28, 44, 53, 87, 93, 97–100, 134, 140, 144–147, 281, 495, 533, 738–739, 759, 771, 809, 815–816, 846, 872, 876–880, 892, 948, 990–991, 996, 1011, 1062, 1067, 1125, 1148, 1165, 1344, 1349–1350, 1357–1362, 1474, 1522, 1531, 1559, 1566, 1579, 1628, 1639, 1641, 1646, 1654, 1659, 1664, 1673, 1678, 1683, 1690
   to_code_visitor.py3201396%83–84, 87–90, 114–115, 196, 321–322, 413–414, 485, 513
   visitors.py2177167%7, 15, 19, 23, 27, 31, 35, 39, 43, 47, 53, 59, 65, 69, 73, 77, 83, 87, 91, 95, 99, 105, 109, 113, 117, 121, 125, 129, 133, 139, 143, 147, 153, 159, 163, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 231, 234, 237, 243, 249, 253, 257, 261, 265, 269, 273, 277, 281, 285, 289, 293, 297, 301, 305, 309, 313
   wtypes.py2963588%21, 69, 181–192, 207–210, 227, 229, 274, 277, 302, 305, 307, 310, 335, 354, 390, 393, 442–443, 452–453, 461–462, 473, 476, 531, 536, 552
src/puya/awst_build
   arc4_utils.py1413674%50, 52, 55, 67, 94–95, 110, 114, 117, 123, 126, 129, 132, 140, 148, 151, 154–166, 169, 178, 181, 282, 312, 319, 322
   base_mypy_visitor.py1334467%39, 59, 71–77, 95, 106–121, 135, 139, 143, 154, 158, 166, 172, 178, 196, 202, 207, 210, 213, 222, 226, 231, 236, 242, 247, 253, 260, 264, 268, 272, 276, 280, 284, 288, 292, 296, 300, 304, 308
   context.py1472285%59–60, 136–141, 149, 151–155, 158–159, 179, 184, 188, 201, 213–214
   contract.py2205973%128–129, 131–134, 142–143, 146, 158, 169, 191, 209, 215, 217, 226, 236, 245, 273, 277, 293–297, 305–306, 311, 314, 317, 320, 325–326, 329, 332, 335, 338, 341, 344, 347, 350, 353, 356, 359, 373, 387–394, 403–410, 417–418, 441, 451–452, 459, 465, 487–493
   intrinsic_models.py32584%21, 26–29
   main.py48394%32, 49, 59
   module.py3687580%68, 116, 134–135, 142, 150, 156, 162–166, 171, 183, 207–208, 219, 249, 275–276, 299, 306, 314–315, 328–329, 352–357, 411–412, 423, 447, 450, 456, 464, 467, 474, 480, 492, 495, 516, 535–536, 553–584, 612–613, 627–629, 631, 633–634, 666–673, 685, 687
   subroutine.py6137388%217, 228, 283, 351, 355, 369, 377, 410–411, 550–564, 572, 580, 583, 595, 631–632, 637, 642, 679, 699–700, 726–732, 785–786, 791, 807, 810, 813, 821–827, 881, 885–886, 890–891, 907, 909, 912–914, 939–940, 948, 983–991, 1026, 1054, 1058, 1089, 1186, 1193, 1203, 1214–1218, 1227, 1230, 1233, 1236, 1239, 1244, 1249, 1256, 1263
   utils.py1722088%48–49, 64, 101, 116, 119–120, 124, 166, 169–170, 189, 203, 216, 223, 248, 259, 280, 333–334
src/puya/awst_build/eb
   _utils.py21290%13–14
   app_account_state.py1282878%51–54, 62, 78, 80, 112–113, 134–141, 162–163, 168, 175–176, 178, 195–196, 203–204, 233, 238–239
   app_state.py1232679%35–40, 51–58, 79–80, 85, 95–96, 101, 118–119, 126–127, 168–169, 192, 210
   array.py684534%26–27, 30–32, 37–44, 56–72, 77–79, 82, 85–88, 93–95, 100–102, 111–123
   base.py2076171%24–31, 103, 107, 111, 117, 121, 127–132, 143–149, 154–160, 166, 172, 182, 192, 196, 200, 210, 213, 216, 219, 222, 225, 230, 233, 255, 276, 279, 284, 287, 290, 293, 296, 301, 304, 315, 328, 338, 341, 354, 375, 380, 389, 392, 396, 403, 406, 409, 414, 419, 424, 430
   biguint.py902276%34–38, 62–63, 77, 92, 102–105, 127–130, 147–152, 169–177, 180–181
   bool.py40880%27–31, 49–50, 53–54, 72
   bytes.py1401986%55–59, 81–82, 93–94, 114–115, 119, 123, 128, 130–131, 151, 173, 294–295, 328
   bytes_backed.py29486%37–38, 47–48
   contracts.py37295%43, 47
   ensure_budget.py481569%25–29, 49–50, 70–71, 79, 91, 97–102
   intrinsics.py1564372%32–34, 55–56, 64–65, 71–72, 89–90, 97, 126, 135, 137–161, 168–169, 213, 221, 233–234, 236, 253–254, 266, 271, 278, 281
   log.py55984%25–29, 77–83, 93, 95
   named_int_constants.py20290%23–24
   struct.py321553%21–22, 25, 35–41, 46–48, 51–56
   subroutine.py33294%51, 66
   template_variables.py471079%25–26, 59–60, 64, 69, 72–73, 82–83
   tuple.py982080%39–40, 47, 58, 60–61, 83–84, 93–94, 107, 113, 131–132, 137–138, 150, 158, 166, 198
   type_registry.py28293%146–147
   uint64.py791581%37–41, 62–63, 84, 102, 125, 144–147, 161–169, 172–173
   unsigned_builtins.py701184%30–34, 51, 58, 92, 95–96, 126, 129–130
   value_proxy.py391269%24, 27, 30, 33, 36, 41, 56, 66, 75, 84, 87, 90
src/puya/awst_build/eb/arc4
   utils.py531081%18, 49–50, 52, 55–56, 78–79, 99, 114
   abi_call.py1992786%48–52, 103–104, 124–125, 129–130, 157, 181, 197–198, 242, 247–249, 298–304, 338–339, 410, 413, 415
   arrays.py2242987%62–66, 79–80, 107, 137, 157–158, 193, 195, 228, 255, 271–272, 285, 328–329, 382–383, 405, 415–416, 432, 461, 480–481, 489, 535
   base.py1151983%36–40, 70–71, 91–92, 161–162, 182, 193–194, 207–208, 225–226, 236, 246, 251
   bool.py28679%22–29, 54–55
   dynamic_bytes.py42588%15–19, 60–61
   numeric.py931782%29–33, 45, 59, 73, 80–81, 99, 113–114, 119, 124, 161–164
   string.py651282%32–36, 54, 77, 91, 110–111, 136–137, 155–156
   struct.py58886%26–33, 68, 71, 106–107
   tuple.py862176%31–35, 50, 54–55, 79, 84–86, 95, 106, 115, 128, 132–133, 144, 160–161, 170–171
src/puya/awst_build/eb/reference_types
   account.py621084%30–34, 51, 60–64, 105
   application.py32778%15–19, 35–36, 40–41
   asset.py52983%26–30, 46–47, 51–52, 88–89
   base.py44491%25–27, 61, 87
src/puya/awst_build/eb/transaction
   base.py33779%16, 24, 28, 33–34, 41, 50
   group.py571574%33–37, 87–88, 141–154
   inner.py56886%27–32, 64–65, 115, 142
   inner_params.py1021189%29–33, 44–45, 55, 110, 145, 169, 185, 217
src/puya/awst_build/validation
   arc4_copy.py42198%37
   inner_transactions.py94298%112, 126
   scratch_slots.py37489%17, 30, 46, 48
src/puya/ir
   arc4_router.py2472092%156, 174, 182, 339, 419, 465, 532–533, 547, 587–588, 600, 605, 610, 615, 620, 625, 645–650
   avm_ops.py316299%44–45
   avm_ops_models.py36294%20, 28
   context.py881286%18, 59–60, 62, 80–86, 91, 102, 109, 119
   main.py175697%113, 116, 245, 247, 303, 314
   models.py4552694%29, 45, 63, 79, 186, 196, 200, 370, 444, 486, 566, 582, 623, 626, 633, 636, 692, 701, 709, 715, 726–728, 738, 750, 787
   ssa.py136993%43, 51–52, 99, 105, 141, 145, 166, 170
   to_text_visitor.py134795%85, 90, 172–177
   types.py50786%27–28, 52–56, 67
   visitor.py1713778%10–12, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 174, 186, 201, 204, 207, 213, 216, 222, 225, 228, 231, 234, 237, 240, 243
   visitor_mutator.py93298%138–139
   vla.py73297%50, 87
src/puya/ir/builder
   _utils.py71889%33, 44, 57, 79–80, 157, 203–204
   arc4.py4184889%75–76, 125, 149–155, 219, 227, 450, 462, 465, 621–635, 964–978, 1004–1028, 1037–1053, 1076, 1177–1178, 1223–1240, 1279–1280, 1333, 1366–1367, 1515–1516, 1579
   assignment.py43588%59, 75, 102, 133–134
   blocks.py931089%62, 72, 76, 112, 120, 124, 157–159, 165–167
   callsub.py57198%93
   flow_control.py98496%63, 117, 141, 155
   iteration.py190597%46, 66, 95, 176–177
   itxn.py2632690%120–121, 136–137, 147–148, 154–159, 185, 464–465, 470–471, 476–477, 483, 494, 511–512, 554–557
   main.py4775389%94, 119, 145, 154, 158, 203–204, 220–221, 248, 256, 263–264, 335, 363–364, 379, 391, 408, 429, 436, 470, 483, 521, 534–535, 599–600, 622, 670, 698, 716, 751–752, 827, 830, 836, 843–844, 874–875, 890, 936–937, 953–954, 988, 1003–1005, 1014, 1017–1018
src/puya/ir/destructure
   coalesce_locals.py941584%33, 36, 118, 127–128, 131–134, 137–139, 153–156
   parcopy.py84298%47, 83
src/puya/ir/optimize
   _utils.py28196%21
   collapse_blocks.py92595%65–69
   control_op_simplification.py1011189%158–165, 239–246
   dead_code_elimination.py118298%287, 323
   intrinsic_simplification.py3704089%64, 128, 140, 202, 268, 326, 332, 383, 405, 426, 428, 434, 478, 480, 482, 489, 505, 519, 525, 527, 529, 534, 536, 538, 540, 542, 545–548, 555, 557, 559, 561, 563, 565, 569, 592–593, 600
   main.py85396%106–107, 123
src/puya/mir
   annotaters.py172796%56, 62, 98, 102, 135, 139, 216
   builder.py122695%90, 138, 144, 151, 258–259
   context.py39197%35
   models.py3352493%14–18, 30, 41, 53, 69–70, 78, 89, 100, 111, 141, 251, 282, 319, 331, 348, 356–362, 368
   output.py61297%29, 31
   stack.py2532291%68, 72, 115, 119, 125, 135, 146, 157, 167, 182, 199, 209, 228, 246, 252, 254, 293, 304, 328, 360, 365, 403
   visitor.py762468%7, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103
src/puya/mir/stack_allocation
   baileys.py208697%31, 103, 123, 330–334, 359
   frame_allocation.py80396%21, 64–65
   koopmans.py61198%55
   peephole.py100694%75, 89, 99, 101, 103, 145
src/puya/teal
   models.py229299%292, 298
src/puya/teal/optimize
   peephole.py112596%64, 154–164, 172
   repeated_rotations.py30197%13
   repeated_rotations_search.py88693%34, 40–41, 57, 67–68
TOTAL15844183988% 

Tests Skipped Failures Errors Time
250 2 💤 0 ❌ 0 🔥 2m 31s ⏱️

@daniel-makerx daniel-makerx force-pushed the optmizer-growing branch 2 times, most recently from 2ee883c to 752a610 Compare March 15, 2024 06:46
@daniel-makerx daniel-makerx enabled auto-merge (squash) March 15, 2024 06:54
@daniel-makerx daniel-makerx merged commit 189847d into main Mar 15, 2024
4 checks passed
@daniel-makerx daniel-makerx deleted the optmizer-growing branch March 15, 2024 06:57
@achidlow achidlow changed the title fix: don't inline control ops of Switch or GotoNth nodes if it would result in additional copies in destructured SSA feat: don't inline control ops of Switch or GotoNth nodes if it would result in additional copies in destructured SSA Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants