aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2023-09-19 22:37:44 +0200
committerRon Evans <[email protected]>2023-10-04 13:05:58 +0200
commit3b1913ac57420af2c665c6f1c3847a6e63774ecd (patch)
tree77460ae8c35853f7f16d4f8575576e677d78e737 /compiler
parent1da1abe3147796aa56a5486ed6f07afdd88d8234 (diff)
downloadtinygo-3b1913ac57420af2c665c6f1c3847a6e63774ecd.tar.gz
tinygo-3b1913ac57420af2c665c6f1c3847a6e63774ecd.zip
all: use the new LLVM pass manager
The old LLVM pass manager is deprecated and should not be used anymore. Moreover, the pass manager builder (which we used to set up a pass pipeline) is actually removed from LLVM entirely in LLVM 17: https://reviews.llvm.org/D145387 https://reviews.llvm.org/D145835 The new pass manager does change the binary size in many cases: both growing and shrinking it. However, on average the binary size remains more or less the same. This is needed as a preparation for LLVM 17.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/compiler_test.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/compiler_test.go b/compiler/compiler_test.go
index fcb2dd7e2..fc62e98e8 100644
--- a/compiler/compiler_test.go
+++ b/compiler/compiler_test.go
@@ -91,14 +91,12 @@ func TestCompiler(t *testing.T) {
}
// Optimize IR a little.
- funcPasses := llvm.NewFunctionPassManagerForModule(mod)
- defer funcPasses.Dispose()
- funcPasses.AddInstructionCombiningPass()
- funcPasses.InitializeFunc()
- for fn := mod.FirstFunction(); !fn.IsNil(); fn = llvm.NextFunction(fn) {
- funcPasses.RunFunc(fn)
+ passOptions := llvm.NewPassBuilderOptions()
+ defer passOptions.Dispose()
+ err = mod.RunPasses("instcombine", llvm.TargetMachine{}, passOptions)
+ if err != nil {
+ t.Error(err)
}
- funcPasses.FinalizeFunc()
outFilePrefix := tc.file[:len(tc.file)-3]
if tc.target != "" {