authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-07 16:31:52-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-07 16:31:52-05:00
log39ee1f4b97053cdc080ddf3562cefc6bed2071a8
treec83df676c1bcb69d576a6788aa706573aab3d14c
parent4a606893097748123c053a2df329e70050a70487
signature Commit is signed but in an unrecognized format.

fix invalid behavior tests from prev commit

and fix "no-op casts" from incorrectly spilling

2 files changed, 10 insertions(+), 4 deletions(-)

src/analyze.cpp+6
......@@ -6369,6 +6369,12 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) {
63696369 // This instruction does its own spilling specially, or otherwise doesn't need it.
63706370 continue;
63716371 }
6372 if (instruction->id == IrInstGenIdCast &&
6373 reinterpret_cast<IrInstGenCast *>(instruction)->cast_op == CastOpNoop)
6374 {
6375 // The IR instruction exists only to change the type according to Zig. No spill needed.
6376 continue;
6377 }
63726378 if (instruction->value->special != ConstValSpecialRuntime)
63736379 continue;
63746380 if (instruction->base.ref_count == 0)
test/stage1/behavior/async_fn.zig+4-4
......@@ -1336,7 +1336,7 @@ test "async function passed 0-bit arg after non-0-bit arg" {
13361336 var global_int: i32 = 0;
13371337
13381338 fn foo() void {
1339 _ = async bar(1, .{});
1339 bar(1, .{}) catch unreachable;
13401340 }
13411341
13421342 fn bar(x: i32, args: var) anyerror!void {
......@@ -1345,7 +1345,7 @@ test "async function passed 0-bit arg after non-0-bit arg" {
13451345 global_int = x;
13461346 }
13471347 };
1348 S.foo();
1348 _ = async S.foo();
13491349 resume S.global_frame;
13501350 expect(S.global_int == 1);
13511351}
......@@ -1357,7 +1357,7 @@ test "async function passed align(16) arg after align(8) arg" {
13571357
13581358 fn foo() void {
13591359 var a: u128 = 99;
1360 _ = async bar(10, .{a});
1360 bar(10, .{a}) catch unreachable;
13611361 }
13621362
13631363 fn bar(x: u64, args: var) anyerror!void {
......@@ -1367,7 +1367,7 @@ test "async function passed align(16) arg after align(8) arg" {
13671367 global_int = args[0];
13681368 }
13691369 };
1370 S.foo();
1370 _ = async S.foo();
13711371 resume S.global_frame;
13721372 expect(S.global_int == 99);
13731373}