interp: fix compile-time alloc linkage

This makes sure compile-time allocations (globals with the $alloc
suffix) can be eliminated when unused.
This commit is contained in:
Ayke van Laethem
2018-11-05 12:44:23 +01:00
parent b4be9e033a
commit 2cd9846cc9
+1
View File
@@ -215,6 +215,7 @@ func (fr *frame) evalBasicBlock(bb, incoming llvm.BasicBlock, indent string) (re
}
alloc := llvm.AddGlobal(fr.Mod, allocType, fr.pkgName+"$alloc")
alloc.SetInitializer(getZeroValue(allocType))
alloc.SetLinkage(llvm.InternalLinkage)
result := &GlobalValue{
Underlying: alloc,
Eval: fr.Eval,