astgen: fix double rvalue wrapping for block expressions in exprRl

The exprRl function was wrapping blockExprExpr's return value in an
extra rvalue() call, but blockExprExpr already applies rvalue internally
for labeled blocks when need_result_rvalue=true. The upstream expr()
function at AstGen.zig:991 returns blockExpr's result directly without
extra rvalue wrapping. This could produce duplicate coercion/store
instructions for non-trivial result locations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 22:12:43 +00:00
parent 811672be4b
commit 1c1407adb8

View File

@@ -4506,7 +4506,7 @@ static uint32_t exprRl(GenZir* gz, Scope* scope, ResultLoc rl, uint32_t node) {
case AST_NODE_BLOCK_TWO_SEMICOLON: case AST_NODE_BLOCK_TWO_SEMICOLON:
case AST_NODE_BLOCK: case AST_NODE_BLOCK:
case AST_NODE_BLOCK_SEMICOLON: case AST_NODE_BLOCK_SEMICOLON:
return rvalue(gz, rl, blockExprExpr(gz, scope, rl, node), node); return blockExprExpr(gz, scope, rl, node);
// Anonymous array init (AstGen.zig:1119-1127). // Anonymous array init (AstGen.zig:1119-1127).
case AST_NODE_ARRAY_INIT_DOT_TWO: case AST_NODE_ARRAY_INIT_DOT_TWO:
case AST_NODE_ARRAY_INIT_DOT_TWO_COMMA: case AST_NODE_ARRAY_INIT_DOT_TWO_COMMA: