aboutsummaryrefslogtreecommitdiffhomepage
path: root/transform/testdata
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-02-07 15:19:25 +0100
committerRon Evans <[email protected]>2022-03-12 12:55:38 +0100
commit603fff78d496445ab3d614c45c75894a9f94999e (patch)
treed981e4616bb52bb29e7a29cbd53cfb16bcfb432a /transform/testdata
parentd4b1467e4c7f1c9e89a8b9efb89a25e9cd6067b2 (diff)
downloadtinygo-603fff78d496445ab3d614c45c75894a9f94999e.tar.gz
tinygo-603fff78d496445ab3d614c45c75894a9f94999e.zip
all: add support for ThinLTO
ThinLTO optimizes across LLVM modules at link time. This means that optimizations (such as inlining and const-propagation) are possible between C and Go. This makes this change especially useful for CGo, but not just for CGo. By doing some optimizations at link time, the linker can discard some unused functions and this leads to a size reduction on average. It does increase code size in some cases, but that's true for most optimizations. I've excluded a number of targets for now (wasm, avr, xtensa, windows, macos). They can probably be supported with some more work, but that should be done in separate PRs. Overall, this change results in an average 3.24% size reduction over all the tinygo.org/x/drivers smoke tests. TODO: this commit runs part of the pass pipeline twice. We should set the PrepareForThinLTO flag in the PassManagerBuilder for even further reduced code size (0.7%) and improved compilation speed.
Diffstat (limited to 'transform/testdata')
-rw-r--r--transform/testdata/stacksize.out.ll1
1 files changed, 1 insertions, 0 deletions
diff --git a/transform/testdata/stacksize.out.ll b/transform/testdata/stacksize.out.ll
index 29f51e34d..cea820ec1 100644
--- a/transform/testdata/stacksize.out.ll
+++ b/transform/testdata/stacksize.out.ll
@@ -2,6 +2,7 @@ target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "armv7m-none-eabi"
@"internal/task.stackSizes" = global [1 x i32] [i32 1024], section ".tinygo_stacksizes"
[email protected] = appending global [2 x i8*] [i8* bitcast ([1 x i32]* @"internal/task.stackSizes" to i8*), i8* bitcast (void (i8*)* @"runtime.run$1$gowrapper" to i8*)]
declare i32 @"internal/task.getGoroutineStackSize"(i32, i8*, i8*)