mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 10:43:29 +00:00
compiler: fix escapes due to nil checks
Some tests get bigger, most get smaller. However, all tested driver examples get smaller in size showing that this is a good change in the real world.
This commit is contained in:
committed by
Ron Evans
parent
cd8471acae
commit
d653088cbe
@@ -379,6 +379,11 @@ func (c *Compiler) Compile(mainPath string) error {
|
||||
c.mod.NamedFunction("runtime.alloc").AddAttributeAtIndex(0, attr)
|
||||
}
|
||||
|
||||
// See emitNilCheck in asserts.go.
|
||||
attrKind := llvm.AttributeKindID("nocapture")
|
||||
attr := c.ctx.CreateEnumAttribute(attrKind, 0)
|
||||
c.mod.NamedFunction("runtime.isnil").AddAttributeAtIndex(1, attr)
|
||||
|
||||
// see: https://reviews.llvm.org/D18355
|
||||
if c.Debug {
|
||||
c.mod.AddNamedMetadataOperand("llvm.module.flags",
|
||||
|
||||
Reference in New Issue
Block a user