terralang / terra

Terra is a low-level system programming language that is embedded in and meta-programmed by the Lua programming language.
terralang.org
Other
2.71k stars 197 forks source link

Add support for LLVM 17 #643

Closed elliottslaughter closed 9 months ago

elliottslaughter commented 11 months ago

This rolls up the changes in #641 and then adds more on top to adapt to the removal of the legacy pass manager in LLVM 17. Overall, this seems to be working dramatically better than LLVM 15-16, so I have updated the opaque pointer version bounds to be LLVM 17-only.

Running the test suite locally (macOS x86) produces one test failure:

99% tests passed, 1 tests failed out of 550

Total Test time (real) = 143.88 sec

The following tests FAILED:
     71 - classifyfloatstructs.t (Failed)
Errors while running CTest

For once I'm actually done with this ahead of the LLVM 17 final release (above results were with rc4), so I can't merge this until the final release gets cut. But things are looking good overall.

Known issues:

elliottslaughter commented 11 months ago

I'm pretty sure classifyfloatstructs.t (the remaining failing test) is failing due to the lack of the manual inliner.

Edit: Actually, no. We use the alwaysinline attribute on functions with :setinlined(true), so it should be inlining. Somehow LLVM is just generating uncompact assembly.

Edit 2: Looks like we're failing to run the SLP vectorizer (or any vectorizer?) because it's not part of the pipeline built by buildFunctionSimplificationPipeline. Looks like LLVM's new pass manager really does want to do everything at module level. Yuck.

elliottslaughter commented 11 months ago

I'm tracking the vectorization issue as https://github.com/llvm/llvm-project/issues/67076

elliottslaughter commented 10 months ago

I'm disabling constantinits.t for LLVM 17 Linux. Tracking as #644.