aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/eval.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-06-08 20:40:16 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-06-08 20:40:16 -0700
commitf4d5fcde727d93da9ebe17a27cc62270545ccda6 (patch)
tree1bb04bf9a99acb6619fae6f2d550672c1249e55c /test/behavior/eval.zig
parent7c0614ea659b3f404f9d702c990afcac5f0b1479 (diff)
downloadzig-f4d5fcde727d93da9ebe17a27cc62270545ccda6.tar.gz
zig-f4d5fcde727d93da9ebe17a27cc62270545ccda6.zip
AstGen: avoid redundant "ref" instructions
Whenever a `ref` instruction is needed, it is created and saved in `AstGen.ref_table` instead of being immediately appended to the current block body. Then, when the referenced instruction is being added to the parent block (e.g. from setBlockBody), if it has a ref_table entry, then the ref instruction is added directly after the instruction being referenced. This makes sure two properties are upheld: 1. All pointers to the same locals return the same address. This is required to be compliant with the language specification. 2. `ref` instructions will dominate their uses. This is a required property of ZIR. A complication arises when a ref instruction refs another ref instruction. The logic in appendBodyWithFixups must take this into account, recursively handling ref refs.
Diffstat (limited to 'test/behavior/eval.zig')
-rw-r--r--test/behavior/eval.zig2
1 files changed, 0 insertions, 2 deletions
diff --git a/test/behavior/eval.zig b/test/behavior/eval.zig
index f14a25451d..220768c820 100644
--- a/test/behavior/eval.zig
+++ b/test/behavior/eval.zig
@@ -1191,8 +1191,6 @@ test "no dependency loop for alignment of self tagged union" {
}
test "equality of pointers to comptime const" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
-
const a: i32 = undefined;
comptime assert(&a == &a);
}