Skip to content

LLVM optimize - #1862

Merged
Bike merged 4 commits into
mainfrom
llvm-optimize
Sep 17, 2026
Merged

Bike merged 4 commits into
mainfrom
llvm-optimize

Conversation

@Bike

@Bike Bike commented Sep 17, 2026

Copy link
Copy Markdown
Member

We haven't actually been optimizing with LLVM for a while due to a remarkably catastrophic typo. This fixes that.

and optimize when doing compile-file, obviously. If you think that's
bad just wait for the next commit.

Basically we should verify before we pass to LLVM optimizations,
because if those are wrong we're debugging LLVM rather than ourselves.
And, we shouldn't verify or optimize until the module is actually
done, so the debug info is output and the literals variable is
swapped out and etc.
jesus tapdancing christ SO: In 434d943 yitzi updated us to use the
snazzy new PassManager introduced around LLVM 17. Unfortunately,
he misread the docs, or made a typo, or something: the code he
wrote built an analysis and optimization pipeline, and then dropped
it to instead run a default-constructed, i.e. empty, pipeline.

I don't blame him for this. LLVM is inscrutable at the best of
times. I do, however, blame myself, for not noticing in the THREE
YEARS it's been since then. Holy shit, man. I think I was inured to
seeing crappy disassemblies so I didn't notice, and I've been
working on bytecode and all, but shit. Straight fucked this one.
My Bad.

at least it's actually fixed now. I'm not sure I can put in a test
for a problem this stupid.
now that LLVM actually friggin optimizes, it quite reasonably turns
the funcalls into tail calls unless we disable optimizations.
debug 3 does that per the perform-optimization policy that sticks
an optnone on.
with optimization on this now matters, e.g. ANSI test misc.198
@Bike
Bike merged commit 9d4327b into main Sep 17, 2026
6 checks passed
@Bike
Bike deleted the llvm-optimize branch September 17, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant