aboutsummaryrefslogtreecommitdiff
path: root/src/ast_render.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-10 10:58:00 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-10 10:58:00 -0500
commit8e68d43ad373e643797209d59e6f10aa12b4c038 (patch)
treee2f3995a2f4db98e1a6b093d905defb2827cdcc0 /src/ast_render.cpp
parent2f9fedabf0805a47aba5c348e5369c1c28f6cf21 (diff)
downloadzig-8e68d43ad373e643797209d59e6f10aa12b4c038.tar.gz
zig-8e68d43ad373e643797209d59e6f10aa12b4c038.zip
avoid needlessly creating global constants
This deletes some legacy cruft, and produces leaner object files. Example: ``` var x: i32 = 1234; export fn entry() i32 { return x; } ``` This produces: ``` @x = internal unnamed_addr global i32 1234, align 4 @0 = internal unnamed_addr constant i32* @x, align 8 ``` and @0 is never even used. After this commit, @0 is not produced. This fixes a bug: Zig was creating invalid LLVM IR when one of these globals that shouldn't exist takes the address of a thread local variable. In LLVM 8.0.0rc2, it would produce a linker error. But probably after my bug report is solved it will be caught by the IR verifier. https://bugs.llvm.org/show_bug.cgi?id=40652
Diffstat (limited to 'src/ast_render.cpp')
0 files changed, 0 insertions, 0 deletions