Unify result-zero-init and zero-init node kinds

This commit is contained in:
Owen Mansel-Chan
2026-07-10 23:39:13 +01:00
parent c8f81bc1c4
commit 992a0b5c17
7 changed files with 62 additions and 100 deletions

View File

@@ -512,7 +512,7 @@ module GoCfg {
not extractNodeCondition(n, i)
or
// A `ValueSpec` without an initializer is written by its `zero-init`
// node directly (see `IR::InitVariableInstruction`), and a
// node directly (see `IR::EvalImplicitInitInstruction`), and a
// tuple-destructuring declaration (`var x, y = f()`) is written by its
// `extract` node; only specs with a per-name initializer emit
// `assign:i`.
@@ -570,15 +570,16 @@ module GoCfg {
tag = "param-init:" + i.toString()
)
or
// Result variable zero init + init (on the function body). This single
// Result-variable zero-initialization (on the function body). This single
// node computes the zero value and writes it to the result variable (see
// `IR::InitResultInstruction`).
// `IR::EvalImplicitInitInstruction`); it is the same kind of node as the
// `zero-init` of an uninitialised local variable.
exists(int i, Go::FuncDef fd |
n = fd.getBody() and
exists(fd.getBody()) and
exists(fd.getResultVar(i)) and
exists(fd.getResultVar(i).(Go::ResultVariable).getFunction().getBody()) and
tag = "result-zero-init:" + i.toString()
tag = "zero-init:" + i.toString()
)
or
// Implicit deref
@@ -1710,7 +1711,7 @@ module GoCfg {
* Function definition prologue and epilogue:
* - Prologue: Before(body) → param-init:-1 → param-init:0 → ... when a
* receiver exists; otherwise it starts at param-init:0. Then
* result-zero-init:0 → result-zero-init:1 → ... → first statement
* zero-init:0 → zero-init:1 → ... → first statement
* - Epilogue: return → result-read:0 → result-read:1 → ... → result-read:last
*
* The last result-read node goes to `NormalExit(fd)` via the shared
@@ -1760,10 +1761,10 @@ module GoCfg {
exists(fd.getParameter(0)) and
n2.isAdditional(fd.getBody(), "param-init:0")
or
// No parameters, has result vars: start with result-zero-init:0
// No parameters, has result vars: start with zero-init:0
not exists(fd.getParameter(_)) and
exists(fd.getResultVar(0)) and
n2.isAdditional(fd.getBody(), "result-zero-init:0")
n2.isAdditional(fd.getBody(), "zero-init:0")
or
// No parameters and no result vars: go directly to Before(body)
not exists(fd.getParameter(_)) and
@@ -1771,7 +1772,7 @@ module GoCfg {
funcDefBodyStart(fd, n2)
)
or
// param-init:i → next: param-init:(i+1), or result-zero-init:0, or Before(body)
// param-init:i → next: param-init:(i+1), or zero-init:0, or Before(body)
exists(int i | exists(fd.getParameter(i)) |
n1.isAdditional(fd.getBody(), "param-init:" + i.toString()) and
(
@@ -1779,10 +1780,10 @@ module GoCfg {
exists(fd.getParameter(i + 1)) and
n2.isAdditional(fd.getBody(), "param-init:" + (i + 1).toString())
or
// No next parameter, has result vars: go to result-zero-init:0
// No next parameter, has result vars: go to zero-init:0
not exists(fd.getParameter(i + 1)) and
exists(fd.getResultVar(0)) and
n2.isAdditional(fd.getBody(), "result-zero-init:0")
n2.isAdditional(fd.getBody(), "zero-init:0")
or
// No next parameter and no result vars: go to Before(body)
not exists(fd.getParameter(i + 1)) and
@@ -1791,15 +1792,15 @@ module GoCfg {
)
)
or
// result-zero-init:j → next: result-zero-init:(j+1), or Before(body).
// zero-init:j → next: zero-init:(j+1), or Before(body).
// The zero-init node also writes the result variable (see
// `IR::InitResultInstruction`), so there is no separate result-init node.
// `IR::EvalImplicitInitInstruction`), so there is no separate result-init node.
exists(int j | exists(fd.getResultVar(j)) |
n1.isAdditional(fd.getBody(), "result-zero-init:" + j.toString()) and
n1.isAdditional(fd.getBody(), "zero-init:" + j.toString()) and
(
// Next result var exists
exists(fd.getResultVar(j + 1)) and
n2.isAdditional(fd.getBody(), "result-zero-init:" + (j + 1).toString())
n2.isAdditional(fd.getBody(), "zero-init:" + (j + 1).toString())
or
// No next result var: go to Before(body)
not exists(fd.getResultVar(j + 1)) and

View File

@@ -642,7 +642,7 @@ module IR {
exists(assgn.(Assignment).getLhs(i))
or
// A `ValueSpec` without an initializer (`var x int`) is written by its
// `zero-init` node directly (see `InitVariableInstruction`), so only
// `zero-init` node directly (see `EvalImplicitInitInstruction`), so only
// specs *with* an initializer produce an `assign` node.
exists(assgn.(ValueSpec).getNameExpr(i)) and
exists(assgn.(ValueSpec).getAnInit())
@@ -786,10 +786,13 @@ module IR {
}
/**
* An instruction that computes the zero value to which a variable without an initializer
* expression is initialized.
* An instruction initializing a variable declared without an initializer
* (a local `var x int`, or a named function result) to its zero value.
*
* The zero-value instruction performs the write of the variable directly,
* rather than feeding a separate write node.
*/
class EvalImplicitInitInstruction extends Instruction {
class EvalImplicitInitInstruction extends WriteInstruction {
ValueEntity v;
EvalImplicitInitInstruction() {
@@ -799,11 +802,13 @@ module IR {
)
or
exists(FuncDef fd, int idx |
this.isAdditional(fd.getBody(), "result-zero-init:" + idx.toString()) and
this.isAdditional(fd.getBody(), "zero-init:" + idx.toString()) and
v = fd.getResultVar(idx)
)
}
override Instruction getRhs() { result = this }
override Type getResultType() { result = v.getType() }
override ControlFlow::Root getRoot() { result.isRootOf(v.getDeclaration()) }
@@ -993,50 +998,6 @@ module IR {
override ControlFlow::Root getRoot() { result = parm.getFunction() }
}
/**
* An instruction initializing a result variable to its zero value.
*
* This is the same node as the `EvalImplicitInitInstruction` that computes the
* zero value: the zero-value instruction performs the write of the result
* variable directly, rather than feeding a separate write node.
*/
class InitResultInstruction extends WriteInstruction {
ResultVariable res;
int idx;
FuncDef fd;
InitResultInstruction() {
this.isAdditional(fd.getBody(), "result-zero-init:" + idx.toString()) and
res = fd.getResultVar(idx)
}
override Instruction getRhs() { result = this }
override ControlFlow::Root getRoot() { result = res.getFunction() }
}
/**
* An instruction initializing a variable declared without an initializer
* (`var x int`) to its zero value.
*
* This is the same node as the `EvalImplicitInitInstruction` that computes the
* zero value: the zero-value instruction performs the write of the variable
* directly, rather than feeding a separate write node.
*/
class InitVariableInstruction extends WriteInstruction {
ValueSpec spec;
int idx;
InitVariableInstruction() {
this.isAdditional(spec, "zero-init:" + idx.toString()) and
exists(spec.getNameExpr(idx))
}
override Instruction getRhs() { result = this }
override ControlFlow::Root getRoot() { result.isRootOf(spec) }
}
/** An instruction that gets the next key-value pair in a range loop. */
class GetNextEntryInstruction extends Instruction {
RangeElementExpr p;
@@ -1152,7 +1113,7 @@ module IR {
)
or
exists(FuncDef fd, int idx |
write.isAdditional(fd.getBody(), "result-zero-init:" + idx.toString()) and
write.isAdditional(fd.getBody(), "zero-init:" + idx.toString()) and
lhs = fd.getResultVar(idx).getDeclaration()
)
or
@@ -1439,7 +1400,7 @@ module IR {
or
exists(FuncDef fd, int i |
fd.getResultVar(i) = v and
result.isAdditional(fd.getBody(), "result-zero-init:" + i.toString())
result.isAdditional(fd.getBody(), "zero-init:" + i.toString())
)
}

View File

@@ -244,11 +244,11 @@
| epilogues.go:42:1:48:1 | Normal Exit | epilogues.go:42:1:48:1 | Exit |
| epilogues.go:42:1:48:1 | function declaration | epilogues.go:42:1:48:1 | After function declaration |
| epilogues.go:42:51:48:1 | block statement | epilogues.go:42:51:48:1 | param-init:0 block statement |
| epilogues.go:42:51:48:1 | param-init:0 block statement | epilogues.go:42:51:48:1 | result-zero-init:0 block statement |
| epilogues.go:42:51:48:1 | param-init:0 block statement | epilogues.go:42:51:48:1 | zero-init:0 block statement |
| epilogues.go:42:51:48:1 | result-read:0 block statement | epilogues.go:42:51:48:1 | result-read:1 block statement |
| epilogues.go:42:51:48:1 | result-read:1 block statement | epilogues.go:42:1:48:1 | Normal Exit |
| epilogues.go:42:51:48:1 | result-zero-init:0 block statement | epilogues.go:42:51:48:1 | result-zero-init:1 block statement |
| epilogues.go:42:51:48:1 | result-zero-init:1 block statement | epilogues.go:43:2:46:2 | if statement |
| epilogues.go:42:51:48:1 | zero-init:0 block statement | epilogues.go:42:51:48:1 | zero-init:1 block statement |
| epilogues.go:42:51:48:1 | zero-init:1 block statement | epilogues.go:43:2:46:2 | if statement |
| epilogues.go:43:2:46:2 | After if statement | epilogues.go:47:2:47:14 | Before return statement |
| epilogues.go:43:2:46:2 | if statement | epilogues.go:43:5:43:9 | Before ...<... |
| epilogues.go:43:5:43:5 | After x | epilogues.go:43:9:43:9 | Before 0 |
@@ -290,9 +290,9 @@
| epilogues.go:51:1:54:1 | Normal Exit | epilogues.go:51:1:54:1 | Exit |
| epilogues.go:51:1:54:1 | function declaration | epilogues.go:51:1:54:1 | After function declaration |
| epilogues.go:51:38:54:1 | block statement | epilogues.go:51:38:54:1 | param-init:0 block statement |
| epilogues.go:51:38:54:1 | param-init:0 block statement | epilogues.go:51:38:54:1 | result-zero-init:0 block statement |
| epilogues.go:51:38:54:1 | param-init:0 block statement | epilogues.go:51:38:54:1 | zero-init:0 block statement |
| epilogues.go:51:38:54:1 | result-read:0 block statement | epilogues.go:51:1:54:1 | Normal Exit |
| epilogues.go:51:38:54:1 | result-zero-init:0 block statement | epilogues.go:52:2:52:10 | ... = ... |
| epilogues.go:51:38:54:1 | zero-init:0 block statement | epilogues.go:52:2:52:10 | ... = ... |
| epilogues.go:52:2:52:10 | ... = ... | epilogues.go:52:6:52:10 | Before ...+... |
| epilogues.go:52:2:52:10 | After ... = ... | epilogues.go:53:2:53:7 | Before return statement |
| epilogues.go:52:2:52:10 | assign:0 ... = ... | epilogues.go:52:2:52:10 | After ... = ... |
@@ -508,9 +508,9 @@
| epilogues.go:87:1:98:1 | Normal Exit | epilogues.go:87:1:98:1 | Exit |
| epilogues.go:87:1:98:1 | function declaration | epilogues.go:87:1:98:1 | After function declaration |
| epilogues.go:87:42:98:1 | block statement | epilogues.go:87:42:98:1 | param-init:0 block statement |
| epilogues.go:87:42:98:1 | param-init:0 block statement | epilogues.go:87:42:98:1 | result-zero-init:0 block statement |
| epilogues.go:87:42:98:1 | param-init:0 block statement | epilogues.go:87:42:98:1 | zero-init:0 block statement |
| epilogues.go:87:42:98:1 | result-read:0 block statement | epilogues.go:87:1:98:1 | Normal Exit |
| epilogues.go:87:42:98:1 | result-zero-init:0 block statement | epilogues.go:88:2:92:4 | Before defer statement |
| epilogues.go:87:42:98:1 | zero-init:0 block statement | epilogues.go:88:2:92:4 | Before defer statement |
| epilogues.go:88:2:92:4 | After defer statement | epilogues.go:93:2:95:2 | if statement |
| epilogues.go:88:2:92:4 | Before defer statement | epilogues.go:88:8:92:4 | function call |
| epilogues.go:88:2:92:4 | defer statement | epilogues.go:88:2:92:4 | After defer statement |
@@ -605,11 +605,11 @@
| epilogues.go:102:1:110:1 | Normal Exit | epilogues.go:102:1:110:1 | Exit |
| epilogues.go:102:1:110:1 | function declaration | epilogues.go:102:1:110:1 | After function declaration |
| epilogues.go:102:50:110:1 | block statement | epilogues.go:102:50:110:1 | param-init:0 block statement |
| epilogues.go:102:50:110:1 | param-init:0 block statement | epilogues.go:102:50:110:1 | result-zero-init:0 block statement |
| epilogues.go:102:50:110:1 | param-init:0 block statement | epilogues.go:102:50:110:1 | zero-init:0 block statement |
| epilogues.go:102:50:110:1 | result-read:0 block statement | epilogues.go:102:50:110:1 | result-read:1 block statement |
| epilogues.go:102:50:110:1 | result-read:1 block statement | epilogues.go:102:1:110:1 | Normal Exit |
| epilogues.go:102:50:110:1 | result-zero-init:0 block statement | epilogues.go:102:50:110:1 | result-zero-init:1 block statement |
| epilogues.go:102:50:110:1 | result-zero-init:1 block statement | epilogues.go:103:2:103:19 | Before defer statement |
| epilogues.go:102:50:110:1 | zero-init:0 block statement | epilogues.go:102:50:110:1 | zero-init:1 block statement |
| epilogues.go:102:50:110:1 | zero-init:1 block statement | epilogues.go:103:2:103:19 | Before defer statement |
| epilogues.go:103:2:103:19 | After defer statement | epilogues.go:104:2:106:2 | if statement |
| epilogues.go:103:2:103:19 | Before defer statement | epilogues.go:103:8:103:19 | call to epiRecover |
| epilogues.go:103:2:103:19 | defer statement | epilogues.go:103:2:103:19 | After defer statement |
@@ -1275,9 +1275,9 @@
| exprs.go:49:1:54:1 | Normal Exit | exprs.go:49:1:54:1 | Exit |
| exprs.go:49:1:54:1 | function declaration | exprs.go:49:1:54:1 | After function declaration |
| exprs.go:49:30:54:1 | block statement | exprs.go:49:30:54:1 | param-init:0 block statement |
| exprs.go:49:30:54:1 | param-init:0 block statement | exprs.go:49:30:54:1 | result-zero-init:0 block statement |
| exprs.go:49:30:54:1 | param-init:0 block statement | exprs.go:49:30:54:1 | zero-init:0 block statement |
| exprs.go:49:30:54:1 | result-read:0 block statement | exprs.go:49:1:54:1 | Normal Exit |
| exprs.go:49:30:54:1 | result-zero-init:0 block statement | exprs.go:50:2:52:2 | for statement |
| exprs.go:49:30:54:1 | zero-init:0 block statement | exprs.go:50:2:52:2 | for statement |
| exprs.go:50:2:52:2 | After for statement | exprs.go:53:2:53:7 | Before return statement |
| exprs.go:50:2:52:2 | [LoopHeader] for statement | exprs.go:50:27:50:29 | Before increment statement |
| exprs.go:50:2:52:2 | for statement | exprs.go:50:6:50:11 | ... := ... |
@@ -2115,9 +2115,9 @@
| main.go:47:1:50:1 | Entry | main.go:47:25:50:1 | block statement |
| main.go:47:1:50:1 | Normal Exit | main.go:47:1:50:1 | Exit |
| main.go:47:1:50:1 | function declaration | main.go:47:1:50:1 | After function declaration |
| main.go:47:25:50:1 | block statement | main.go:47:25:50:1 | result-zero-init:0 block statement |
| main.go:47:25:50:1 | block statement | main.go:47:25:50:1 | zero-init:0 block statement |
| main.go:47:25:50:1 | result-read:0 block statement | main.go:47:1:50:1 | Normal Exit |
| main.go:47:25:50:1 | result-zero-init:0 block statement | main.go:48:2:48:12 | ... = ... |
| main.go:47:25:50:1 | zero-init:0 block statement | main.go:48:2:48:12 | ... = ... |
| main.go:48:2:48:12 | ... = ... | main.go:48:11:48:12 | Before 42 |
| main.go:48:2:48:12 | After ... = ... | main.go:49:2:49:7 | Before return statement |
| main.go:48:2:48:12 | assign:0 ... = ... | main.go:48:2:48:12 | After ... = ... |
@@ -2131,9 +2131,9 @@
| main.go:52:1:54:1 | Entry | main.go:52:26:54:1 | block statement |
| main.go:52:1:54:1 | Normal Exit | main.go:52:1:54:1 | Exit |
| main.go:52:1:54:1 | function declaration | main.go:52:1:54:1 | After function declaration |
| main.go:52:26:54:1 | block statement | main.go:52:26:54:1 | result-zero-init:0 block statement |
| main.go:52:26:54:1 | block statement | main.go:52:26:54:1 | zero-init:0 block statement |
| main.go:52:26:54:1 | result-read:0 block statement | main.go:52:1:54:1 | Normal Exit |
| main.go:52:26:54:1 | result-zero-init:0 block statement | main.go:53:2:53:7 | Before return statement |
| main.go:52:26:54:1 | zero-init:0 block statement | main.go:53:2:53:7 | Before return statement |
| main.go:53:2:53:7 | Before return statement | main.go:53:2:53:7 | return statement |
| main.go:53:2:53:7 | return statement | main.go:52:26:54:1 | result-read:0 block statement |
| main.go:56:1:64:1 | After function declaration | main.go:66:1:90:1 | Before function declaration |
@@ -2142,9 +2142,9 @@
| main.go:56:1:64:1 | Normal Exit | main.go:56:1:64:1 | Exit |
| main.go:56:1:64:1 | function declaration | main.go:56:1:64:1 | After function declaration |
| main.go:56:38:64:1 | block statement | main.go:56:38:64:1 | param-init:0 block statement |
| main.go:56:38:64:1 | param-init:0 block statement | main.go:56:38:64:1 | result-zero-init:0 block statement |
| main.go:56:38:64:1 | param-init:0 block statement | main.go:56:38:64:1 | zero-init:0 block statement |
| main.go:56:38:64:1 | result-read:0 block statement | main.go:56:1:64:1 | Normal Exit |
| main.go:56:38:64:1 | result-zero-init:0 block statement | main.go:57:2:57:11 | ... = ... |
| main.go:56:38:64:1 | zero-init:0 block statement | main.go:57:2:57:11 | ... = ... |
| main.go:57:2:57:11 | ... = ... | main.go:57:11:57:11 | Before 0 |
| main.go:57:2:57:11 | After ... = ... | main.go:58:2:62:2 | if statement |
| main.go:57:2:57:11 | assign:0 ... = ... | main.go:57:2:57:11 | After ... = ... |
@@ -2345,11 +2345,11 @@
| main.go:92:1:96:1 | Entry | main.go:92:36:96:1 | block statement |
| main.go:92:1:96:1 | Normal Exit | main.go:92:1:96:1 | Exit |
| main.go:92:1:96:1 | function declaration | main.go:92:1:96:1 | After function declaration |
| main.go:92:36:96:1 | block statement | main.go:92:36:96:1 | result-zero-init:0 block statement |
| main.go:92:36:96:1 | block statement | main.go:92:36:96:1 | zero-init:0 block statement |
| main.go:92:36:96:1 | result-read:0 block statement | main.go:92:36:96:1 | result-read:1 block statement |
| main.go:92:36:96:1 | result-read:1 block statement | main.go:92:1:96:1 | Normal Exit |
| main.go:92:36:96:1 | result-zero-init:0 block statement | main.go:92:36:96:1 | result-zero-init:1 block statement |
| main.go:92:36:96:1 | result-zero-init:1 block statement | main.go:93:2:93:8 | ... := ... |
| main.go:92:36:96:1 | zero-init:0 block statement | main.go:92:36:96:1 | zero-init:1 block statement |
| main.go:92:36:96:1 | zero-init:1 block statement | main.go:93:2:93:8 | ... := ... |
| main.go:93:2:93:8 | ... := ... | main.go:93:7:93:8 | Before 23 |
| main.go:93:2:93:8 | After ... := ... | main.go:94:2:94:15 | ... = ... |
| main.go:93:2:93:8 | assign:0 ... := ... | main.go:93:2:93:8 | After ... := ... |

View File

@@ -51,8 +51,8 @@
| main.go:46:44:52:1 | SSA def(vals) | main.go:48:3:48:6 | vals |
| main.go:46:44:52:1 | SSA def(xs) | main.go:47:20:47:21 | xs |
| main.go:46:44:52:1 | param-init:0 block statement | main.go:46:44:52:1 | SSA def(xs) |
| main.go:46:44:52:1 | result-zero-init:0 block statement | main.go:46:44:52:1 | SSA def(keys) |
| main.go:46:44:52:1 | result-zero-init:1 block statement | main.go:46:44:52:1 | SSA def(vals) |
| main.go:46:44:52:1 | zero-init:0 block statement | main.go:46:44:52:1 | SSA def(keys) |
| main.go:46:44:52:1 | zero-init:1 block statement | main.go:46:44:52:1 | SSA def(vals) |
| main.go:47:2:50:2 | SSA def(k) | main.go:49:11:49:11 | k |
| main.go:47:2:50:2 | SSA def(v) | main.go:48:11:48:11 | v |
| main.go:47:2:50:2 | extract:0 range element | main.go:47:2:50:2 | SSA def(k) |

View File

@@ -1,21 +1,21 @@
| result | main.go:5:1:11:1 | function declaration | main.go:7:10:7:14 | ...+... |
| result | main.go:5:1:11:1 | function declaration | main.go:9:10:9:14 | ...-... |
| result | main.go:13:1:20:1 | function declaration | main.go:13:45:20:1 | result-zero-init:0 block statement |
| result | main.go:13:1:20:1 | function declaration | main.go:13:45:20:1 | zero-init:0 block statement |
| result | main.go:13:1:20:1 | function declaration | main.go:15:9:15:13 | ...+... |
| result | main.go:13:1:20:1 | function declaration | main.go:17:10:17:14 | ...-... |
| result | main.go:26:1:29:1 | function declaration | main.go:28:9:28:15 | selection of count |
| result | reset.go:8:1:16:1 | function declaration | reset.go:15:9:15:12 | sink |
| result 0 | main.go:31:1:33:1 | function declaration | main.go:32:9:32:10 | 23 |
| result 0 | main.go:35:1:38:1 | function declaration | main.go:35:29:38:1 | result-zero-init:0 block statement |
| result 0 | main.go:35:1:38:1 | function declaration | main.go:35:29:38:1 | zero-init:0 block statement |
| result 0 | main.go:35:1:38:1 | function declaration | main.go:36:13:36:14 | 23 |
| result 0 | main.go:40:1:48:1 | function declaration | main.go:40:33:48:1 | result-zero-init:0 block statement |
| result 0 | main.go:40:1:48:1 | function declaration | main.go:40:33:48:1 | zero-init:0 block statement |
| result 0 | main.go:40:1:48:1 | function declaration | main.go:45:10:45:10 | 0 |
| result 0 | main.go:40:1:48:1 | function declaration | main.go:47:9:47:9 | 0 |
| result 0 | tst2.go:8:1:12:1 | function declaration | tst2.go:11:9:11:9 | w |
| result 1 | main.go:31:1:33:1 | function declaration | main.go:32:13:32:14 | 42 |
| result 1 | main.go:35:1:38:1 | function declaration | main.go:35:29:38:1 | result-zero-init:1 block statement |
| result 1 | main.go:35:1:38:1 | function declaration | main.go:35:29:38:1 | zero-init:1 block statement |
| result 1 | main.go:35:1:38:1 | function declaration | main.go:36:9:36:10 | 42 |
| result 1 | main.go:40:1:48:1 | function declaration | main.go:40:33:48:1 | result-zero-init:1 block statement |
| result 1 | main.go:40:1:48:1 | function declaration | main.go:40:33:48:1 | zero-init:1 block statement |
| result 1 | main.go:40:1:48:1 | function declaration | main.go:42:3:42:5 | incdec-rhs increment statement |
| result 1 | main.go:40:1:48:1 | function declaration | main.go:45:13:45:13 | 1 |
| result 1 | main.go:40:1:48:1 | function declaration | main.go:47:12:47:12 | 4 |

View File

@@ -18,15 +18,15 @@
| main.go:19:10:19:24 | "Hello, world!" | main.go:19:10:19:24 | "Hello, world!" |
| main.go:20:2:20:16 | call to Println | main.go:20:2:20:16 | call to Println |
| main.go:23:23:26:1 | result-read:0 block statement | main.go:24:8:24:8 | 4 |
| main.go:23:23:26:1 | result-zero-init:0 block statement | main.go:10:7:10:7 | 0 |
| main.go:23:23:26:1 | zero-init:0 block statement | main.go:10:7:10:7 | 0 |
| main.go:24:2:24:8 | SSA def(res) | main.go:24:8:24:8 | 4 |
| main.go:24:8:24:8 | 4 | main.go:24:8:24:8 | 4 |
| main.go:28:24:31:1 | result-read:0 block statement | main.go:30:9:30:9 | 6 |
| main.go:28:24:31:1 | result-zero-init:0 block statement | main.go:10:7:10:7 | 0 |
| main.go:28:24:31:1 | zero-init:0 block statement | main.go:10:7:10:7 | 0 |
| main.go:29:8:29:8 | 5 | main.go:29:8:29:8 | 5 |
| main.go:30:2:30:9 | SSA def(res) | main.go:30:9:30:9 | 6 |
| main.go:30:9:30:9 | 6 | main.go:30:9:30:9 | 6 |
| main.go:33:24:39:1 | result-zero-init:0 block statement | main.go:10:7:10:7 | 0 |
| main.go:33:24:39:1 | zero-init:0 block statement | main.go:10:7:10:7 | 0 |
| main.go:34:8:34:8 | 7 | main.go:34:8:34:8 | 7 |
| main.go:35:8:37:4 | defer-invoke function call | main.go:35:8:37:4 | function call |
| main.go:36:3:36:9 | SSA def(res) | main.go:36:9:36:9 | 8 |

View File

@@ -10,9 +10,9 @@
| main.go:34:19:36:1 | param-init:0 block statement | main.go:34:11:34:11 | x | main.go:34:19:36:1 | param-init:0 block statement |
| main.go:39:2:39:8 | assign:0 ... := ... | main.go:39:2:39:2 | x | main.go:39:7:39:8 | 23 |
| main.go:40:2:40:10 | assign:0 ... := ... | main.go:40:2:40:4 | ptr | main.go:40:9:40:10 | &... |
| main.go:47:25:50:1 | result-zero-init:0 block statement | main.go:47:13:47:18 | result | main.go:47:25:50:1 | result-zero-init:0 block statement |
| main.go:47:25:50:1 | zero-init:0 block statement | main.go:47:13:47:18 | result | main.go:47:25:50:1 | zero-init:0 block statement |
| main.go:48:2:48:12 | assign:0 ... = ... | main.go:47:13:47:18 | result | main.go:48:11:48:12 | 42 |
| main.go:52:26:54:1 | result-zero-init:0 block statement | main.go:52:14:52:19 | result | main.go:52:26:54:1 | result-zero-init:0 block statement |
| main.go:52:26:54:1 | zero-init:0 block statement | main.go:52:14:52:19 | result | main.go:52:26:54:1 | zero-init:0 block statement |
| main.go:57:6:57:10 | zero-init:0 value declaration specifier | main.go:57:6:57:6 | x | main.go:57:6:57:10 | zero-init:0 value declaration specifier |
| main.go:59:3:59:7 | assign:0 ... = ... | main.go:57:6:57:6 | x | main.go:59:7:59:7 | 2 |
| main.go:63:2:63:7 | assign:0 ... := ... | main.go:63:2:63:2 | y | main.go:63:7:63:7 | 1 |
@@ -23,8 +23,8 @@
| main.go:73:6:73:11 | assign:0 ... := ... | main.go:73:6:73:6 | i | main.go:73:11:73:11 | 0 |
| main.go:73:16:73:18 | increment statement | main.go:73:6:73:6 | i | main.go:73:16:73:18 | incdec-rhs increment statement |
| main.go:74:3:74:7 | assign:0 ... = ... | main.go:72:2:72:2 | z | main.go:74:7:74:7 | 2 |
| main.go:82:36:86:1 | result-zero-init:0 block statement | main.go:82:18:82:18 | a | main.go:82:36:86:1 | result-zero-init:0 block statement |
| main.go:82:36:86:1 | result-zero-init:1 block statement | main.go:82:25:82:25 | b | main.go:82:36:86:1 | result-zero-init:1 block statement |
| main.go:82:36:86:1 | zero-init:0 block statement | main.go:82:18:82:18 | a | main.go:82:36:86:1 | zero-init:0 block statement |
| main.go:82:36:86:1 | zero-init:1 block statement | main.go:82:25:82:25 | b | main.go:82:36:86:1 | zero-init:1 block statement |
| main.go:83:2:83:8 | assign:0 ... := ... | main.go:83:2:83:2 | x | main.go:83:7:83:8 | 23 |
| main.go:84:2:84:15 | assign:0 ... = ... | main.go:83:2:83:2 | x | main.go:84:9:84:12 | ...+... |
| main.go:84:2:84:15 | assign:1 ... = ... | main.go:82:18:82:18 | a | main.go:84:15:84:15 | x |