aboutsummaryrefslogtreecommitdiffhomepage
path: root/compileopts/config.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-11-25 02:27:27 +0100
committerAyke <[email protected]>2023-01-25 18:43:00 +0100
commitda362b8a24fe271bd03a98d44305c47bcfefe05b (patch)
tree6d2764fca6a50b22ac3811e2487a74aab7cb74a3 /compileopts/config.go
parent7fa13ed0a663f4358144fa211369d03aae06b7a2 (diff)
downloadtinygo-da362b8a24fe271bd03a98d44305c47bcfefe05b.tar.gz
tinygo-da362b8a24fe271bd03a98d44305c47bcfefe05b.zip
wasm: support ThinLTO
Using ThinLTO manages to optimize binaries quite significantly. The exact amount varies a lot by program but it's about 10-15% usually. Don't remove non-ThinLTO support yet. It would not surprise me if this triggered some unintended side effect. Eventually, non-ThinLTO support should be removed though.
Diffstat (limited to 'compileopts/config.go')
-rw-r--r--compileopts/config.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/compileopts/config.go b/compileopts/config.go
index b22db15dc..499dcd27a 100644
--- a/compileopts/config.go
+++ b/compileopts/config.go
@@ -190,17 +190,11 @@ func (c *Config) StackSize() uint64 {
return c.Target.DefaultStackSize
}
-// UseThinLTO returns whether ThinLTO should be used for the given target. Some
-// targets (such as wasm) are not yet supported.
-// We should try and remove as many exceptions as possible in the future, so
-// that this optimization can be applied in more places.
+// UseThinLTO returns whether ThinLTO should be used for the given target.
func (c *Config) UseThinLTO() bool {
- parts := strings.Split(c.Triple(), "-")
- if parts[0] == "wasm32" {
- // wasm-ld doesn't seem to support ThinLTO yet.
- return false
- }
- // Other architectures support ThinLTO.
+ // All architectures support ThinLTO now. However, this code is kept for the
+ // time being in case there are regressions. The non-ThinLTO code support
+ // should be removed when it is proven to work reliably.
return true
}