aboutsummaryrefslogtreecommitdiff
path: root/test/cases/assert_function.17.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-04-14 21:38:32 +0100
committermlugg <mlugg@mlugg.co.uk>2023-04-20 20:28:48 +0100
commit407dc6eee4660bb0744c55f4565be77501ec7d37 (patch)
tree8e58be56dea4c1f318b0cb57ea7d4ab9d85076a7 /test/cases/assert_function.17.zig
parent4486f271266b330f683ccc266ce19ddbd55e7f59 (diff)
downloadzig-407dc6eee4660bb0744c55f4565be77501ec7d37.tar.gz
zig-407dc6eee4660bb0744c55f4565be77501ec7d37.zip
Liveness: avoid emitting unused instructions or marking their operands as used
Backends want to avoid emitting unused instructions which do not have side effects: to that end, they all have `Liveness.isUnused` checks for many instructions. However, checking this in the backends avoids a lot of potential optimizations. For instance, if a nested field is loaded, then the first field access would still be emitted, since its result is used by the next access (which is then unreferenced). To elide more instructions, Liveness can track this data instead. For operands which do not have to be lowered (i.e. are not side effecting and are not something special like `arg), Liveness can ignore their operand usages, and push the unused information further up, potentially marking many more instructions as unreferenced. In doing this, I also uncovered a bug in the LLVM backend relating to discarding the result of `@cVaArg`, which this change fixes. A behaviour test has been added to cover it.
Diffstat (limited to 'test/cases/assert_function.17.zig')
0 files changed, 0 insertions, 0 deletions