From 6bf5a1b39647c4e4a2ca2874e827073472e259a1 Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Tue, 22 Nov 2022 08:03:40 -0800 Subject: [PATCH] [codegen] Elide final return stmt if no value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a random driveby improvement. I realized that we can eliminate `return` statements if a) they have no value and b) they are in the top-level block. Functions implicitly return at that point — there can't be any succeeding instructions anyway — so we can save bytes in the output. --- compiler/forget/src/HIR/Codegen.ts | 8 ++++++++ .../__tests__/fixtures/hir/alias-while.expect.md | 4 +--- .../fixtures/hir/assignment-variations.expect.md | 2 -- .../src/__tests__/fixtures/hir/call.expect.md | 4 +--- .../fixtures/hir/complex-while.expect.md | 1 - .../hir/conditional-on-mutable.expect.md | 8 ++------ .../__tests__/fixtures/hir/constructor.expect.md | 4 +--- .../fixtures/hir/frozen-after-alias.expect.md | 9 ++------- .../__tests__/fixtures/hir/hook-call.expect.md | 8 ++------ .../hir/hooks-freeze-arguments.expect.md | 8 ++------ ...s-freeze-possibly-mutable-arguments.expect.md | 8 ++------ .../fixtures/hir/independent-across-if.expect.md | 16 ++++------------ .../__tests__/fixtures/hir/independent.expect.md | 12 +++--------- .../hir/interdependent-across-if.expect.md | 12 +++--------- .../fixtures/hir/interdependent.expect.md | 12 +++--------- .../__tests__/fixtures/hir/inverted-if.expect.md | 2 -- .../fixtures/hir/logical-expression.expect.md | 8 ++------ .../hir/mutable-lifetime-loops.expect.md | 9 ++------- .../hir/mutable-lifetime-with-aliasing.expect.md | 5 +---- .../hir/mutable-liverange-loop.expect.md | 9 ++------- .../fixtures/hir/reverse-postorder.expect.md | 1 - .../fixtures/hir/simple-alias.expect.md | 4 +--- .../fixtures/hir/ssa-call-jsx-2.expect.md | 4 +--- .../fixtures/hir/ssa-call-jsx.expect.md | 4 +--- .../hir/ssa-complex-multiple-if.expect.md | 1 - .../fixtures/hir/ssa-complex-single-if.expect.md | 1 - .../__tests__/fixtures/hir/ssa-if-else.expect.md | 2 -- .../fixtures/hir/ssa-newexpression.expect.md | 4 +--- .../fixtures/hir/ssa-shadowing.expect.md | 5 +---- .../fixtures/hir/ssa-simple-phi.expect.md | 1 - .../__tests__/fixtures/hir/ssa-simple.expect.md | 1 - .../fixtures/hir/ssa-single-if.expect.md | 2 -- .../__tests__/fixtures/hir/ssa-switch.expect.md | 1 - .../hir/switch-with-fallthrough.expect.md | 2 -- .../hir/while-conditional-continue.expect.md | 1 - 35 files changed, 46 insertions(+), 137 deletions(-) diff --git a/compiler/forget/src/HIR/Codegen.ts b/compiler/forget/src/HIR/Codegen.ts index c095f1576c..6193788757 100644 --- a/compiler/forget/src/HIR/Codegen.ts +++ b/compiler/forget/src/HIR/Codegen.ts @@ -94,9 +94,11 @@ class CodegenVisitor t.SwitchCase > { + depth: number = 0; temp: Map = new Map(); enterBlock(): t.Statement[] { + this.depth++; return []; } visitValue( @@ -190,6 +192,11 @@ class CodegenVisitor case "return": { if (terminal.value !== null) { return t.returnStatement(terminal.value); + } else if (this.depth === 1) { + // A return at the top-level of a function must be the last instruction, + // and functions implicitly return after the last instruction of the top-level. + // Elide the return. + return t.emptyStatement(); } else { return t.returnStatement(); } @@ -223,6 +230,7 @@ class CodegenVisitor } } leaveBlock(block: t.Statement[]): t.Statement { + this.depth--; return t.blockStatement(block); } } diff --git a/compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md b/compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md index 2df6d5560d..9bd48ba87f 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md @@ -140,9 +140,7 @@ flowchart TB ## Code ```javascript -function mutate$0(x$1, y$2) { - return; -} +function mutate$0(x$1, y$2) {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md b/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md index 369e7f9992..5585422a05 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md @@ -60,7 +60,6 @@ function f$0() { x$1 = x$1 + 1; x$1 = x$1 + 1; x$1 = x$1 >>> 1; - return; } ``` @@ -100,7 +99,6 @@ flowchart TB function g$0(a$1) { a$1.c.b = a$1.b.c + 1; a$1.c.b = a$1.b.c * 2; - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/call.expect.md index f03d6b1af4..4628ec5806 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/call.expect.md @@ -38,9 +38,7 @@ flowchart TB ## Code ```javascript -function foo$0() { - return; -} +function foo$0() {} ``` ## HIR diff --git a/compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md b/compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md index 1c4a6595e6..167b2ff5a6 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md @@ -83,7 +83,6 @@ function foo$0(a$1, b$2, c$3) { bb7: if (c$3) break; } } - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md b/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md index 139ba43615..16201e6521 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md @@ -260,9 +260,7 @@ flowchart TB ## Code ```javascript -function Foo$0() { - return; -} +function Foo$0() {} ``` ## HIR @@ -288,9 +286,7 @@ flowchart TB ## Code ```javascript -function mayMutate$0() { - return; -} +function mayMutate$0() {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md b/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md index 41488368b6..7da105640c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md @@ -38,9 +38,7 @@ flowchart TB ## Code ```javascript -function Foo$0() { - return; -} +function Foo$0() {} ``` ## HIR diff --git a/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md index 0bf2f38fb3..d4d93d7a9a 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md @@ -52,7 +52,6 @@ function Component$0() { const b$2 = a$1; useFreeze$3(a$1); foo$4(b$2); - return; } ``` @@ -79,9 +78,7 @@ flowchart TB ## Code ```javascript -function useFreeze$0() { - return; -} +function useFreeze$0() {} ``` ## HIR @@ -107,9 +104,7 @@ flowchart TB ## Code ```javascript -function foo$0(x$1) { - return; -} +function foo$0(x$1) {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md index 1715e03f4d..2eea852daa 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md @@ -42,9 +42,7 @@ flowchart TB ## Code ```javascript -function useFreeze$0() { - return; -} +function useFreeze$0() {} ``` ## HIR @@ -70,9 +68,7 @@ flowchart TB ## Code ```javascript -function foo$0() { - return; -} +function foo$0() {} ``` ## HIR diff --git a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md index 130f0a8d47..6d6a58ce19 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md @@ -80,9 +80,7 @@ flowchart TB ## Code ```javascript -function useFreeze$0(x$1) { - return; -} +function useFreeze$0(x$1) {} ``` ## HIR @@ -108,9 +106,7 @@ flowchart TB ## Code ```javascript -function call$0(x$1) { - return; -} +function call$0(x$1) {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md index 60734056e4..992160d1d7 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md @@ -132,9 +132,7 @@ flowchart TB ## Code ```javascript -function useFreeze$0(x$1) { - return; -} +function useFreeze$0(x$1) {} ``` ## HIR @@ -160,9 +158,7 @@ flowchart TB ## Code ```javascript -function call$0(x$1) { - return; -} +function call$0(x$1) {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md index b34cf51a33..fa88734c00 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md @@ -56,9 +56,7 @@ flowchart TB ## Code ```javascript -function compute$0() { - return; -} +function compute$0() {} ``` ## HIR @@ -84,9 +82,7 @@ flowchart TB ## Code ```javascript -function mutate$0() { - return; -} +function mutate$0() {} ``` ## HIR @@ -112,9 +108,7 @@ flowchart TB ## Code ```javascript -function foo$0() { - return; -} +function foo$0() {} ``` ## HIR @@ -140,9 +134,7 @@ flowchart TB ## Code ```javascript -function Foo$0() { - return; -} +function Foo$0() {} ``` ## HIR diff --git a/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md index b4fdedcbdb..20c7e0e44a 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md @@ -85,9 +85,7 @@ flowchart TB ## Code ```javascript -function compute$0() { - return; -} +function compute$0() {} ``` ## HIR @@ -113,9 +111,7 @@ flowchart TB ## Code ```javascript -function foo$0() { - return; -} +function foo$0() {} ``` ## HIR @@ -141,9 +137,7 @@ flowchart TB ## Code ```javascript -function Foo$0() { - return; -} +function Foo$0() {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md index abe3c1b7b7..4a2792e746 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md @@ -50,9 +50,7 @@ flowchart TB ## Code ```javascript -function compute$0() { - return; -} +function compute$0() {} ``` ## HIR @@ -78,9 +76,7 @@ flowchart TB ## Code ```javascript -function foo$0() { - return; -} +function foo$0() {} ``` ## HIR @@ -106,9 +102,7 @@ flowchart TB ## Code ```javascript -function Foo$0() { - return; -} +function Foo$0() {} ``` ## HIR diff --git a/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md b/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md index 4e883e0572..d1cc6cf443 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md @@ -88,9 +88,7 @@ flowchart TB ## Code ```javascript -function compute$0() { - return; -} +function compute$0() {} ``` ## HIR @@ -116,9 +114,7 @@ flowchart TB ## Code ```javascript -function foo$0() { - return; -} +function foo$0() {} ``` ## HIR @@ -144,9 +140,7 @@ flowchart TB ## Code ```javascript -function Foo$0() { - return; -} +function Foo$0() {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md index aa970af6bf..e303679ebd 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md @@ -75,8 +75,6 @@ function foo$0(a$1, b$2, c$3) { y$4.push(c$3); } } - - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md b/compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md index 356059267c..ccb4ba8336 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md @@ -244,9 +244,7 @@ flowchart TB ## Code ```javascript -function f$0() { - return; -} +function f$0() {} ``` ## HIR @@ -272,9 +270,7 @@ flowchart TB ## Code ```javascript -function g$0() { - return; -} +function g$0() {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md index 4d9f18e4ac..e1dbd9ef47 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md @@ -62,9 +62,7 @@ flowchart TB ## Code ```javascript -function mutate$0(x$1, y$2) { - return; -} +function mutate$0(x$1, y$2) {} ``` ## HIR @@ -90,9 +88,7 @@ flowchart TB ## Code ```javascript -function cond$0(x$1) { - return; -} +function cond$0(x$1) {} ``` ## HIR @@ -247,7 +243,6 @@ function Component$0(props$1) { } mutate$7(d$5, null); - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md index 2b7ba17595..937bd96b22 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md @@ -58,9 +58,7 @@ flowchart TB ## Code ```javascript -function mutate$0(x$1, y$2) { - return; -} +function mutate$0(x$1, y$2) {} ``` ## HIR @@ -174,7 +172,6 @@ function Component$0(props$1) { } mutate$8(x$6, null); - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md index 21f369429e..c206727389 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md @@ -57,9 +57,7 @@ flowchart TB ## Code ```javascript -function mutate$0() { - return; -} +function mutate$0() {} ``` ## HIR @@ -85,9 +83,7 @@ flowchart TB ## Code ```javascript -function cond$0() { - return; -} +function cond$0() {} ``` ## HIR @@ -227,7 +223,6 @@ function Component$0(props$1) { } mutate$6(d$5, null); - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md index 1472a45216..39b90ca8c3 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md @@ -189,7 +189,6 @@ function Component$0(props$1) { } x$2; - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md index fd7bf6164a..6bed65657f 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md @@ -39,9 +39,7 @@ flowchart TB ## Code ```javascript -function mutate$0() { - return; -} +function mutate$0() {} ``` ## HIR diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md index 9aa475d850..ce426e8558 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md @@ -41,9 +41,7 @@ flowchart TB ## Code ```javascript -function foo$0() { - return; -} +function foo$0() {} ``` ## HIR diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md index d0e082fb0d..06a22d2994 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md @@ -38,9 +38,7 @@ flowchart TB ## Code ```javascript -function foo$0() { - return; -} +function foo$0() {} ``` ## HIR diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md index ce6ba4d3e7..ed7ab64412 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md @@ -110,7 +110,6 @@ function foo$0() { } y$2 = x$1; - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md index d1e93fa453..b2a5a715df 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md @@ -78,7 +78,6 @@ function foo$0() { } y$2 = x$1; - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md index fef0f6a90a..cf44b88daf 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md @@ -83,8 +83,6 @@ function foo$0() { } else { let z$4 = x$1; } - - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md index 60a8a93034..92bbd7cb78 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md @@ -36,9 +36,7 @@ flowchart TB ## Code ```javascript -function Foo$0() { - return; -} +function Foo$0() {} ``` ## HIR diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md index 2dc0a98a9c..4ba6b0ae46 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md @@ -40,9 +40,7 @@ flowchart TB ## Code ```javascript -function log$0() { - return; -} +function log$0() {} ``` ## HIR @@ -119,7 +117,6 @@ function Foo$0(cond$1) { } log$4(str$2); - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md index e260f6aa7f..0b7e5ac4af 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md @@ -91,7 +91,6 @@ function foo$0() { } let x$4 = y$1; - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md index 8c4774e683..d5c547125f 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md @@ -41,7 +41,6 @@ flowchart TB function foo$0() { let x$1 = 1; let y$2 = 2; - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md index 690151d5cb..ba0b3f3ab6 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md @@ -67,8 +67,6 @@ function foo$0() { bb1: if (y$2) { let z$3 = x$1 + y$2; } - - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md index 1a8807f923..9cc3460938 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md @@ -134,7 +134,6 @@ function foo$0() { } let y$9 = x$1; - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md b/compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md index 91c3e8ef0e..4406f18d32 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md @@ -191,8 +191,6 @@ function foo$0(x$1) { y$2 = 0; } } - - return; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md b/compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md index 94abf9e763..411b043133 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md @@ -94,7 +94,6 @@ function foo$0(a$1, b$2, c$3, d$4) { } d$4(); - return; } ```