Just was listening to some LLVM terrible compilation time issues:
In this example, someone made a tuple with 2000 elements (all u8). Took 3 seconds to compile.
They then made a tuple with 5000 elements.... it took 2 minutes to compile.
This is for like 7 lines of code that just creates a zeroed tuple and then sets a few values in it.
The reason was that the generated llvm ir did something like:
%val = load [2000 x u8] %mem
And in the 5000 case, just swap out the number with 5000
.
Why does this explode llvm: ssa values in llvm are meant to be passed in registers
So this was asking llvm to simply load the value into the 2000 registers it has lying around.
Or 5000 in the worse case.
Fundamental comment/lesson: llvm ssa values are meant to fit in roughly 2 or 3 registers. Anything else should never be an ssa value.
llvm is not built for that and will explode.
Just a general reminder of things we should make sure to avoid in our llvm ir.
Last updated: Jul 06 2025 at 12:14 UTC