Skip to content

WIP: Make illegal branch actually branch to unreachable in the LLVM backend

During code generation for a CmmSwitch, if we do not have a default branch to take (switchTargetsDefault = Nothing), generate the "morally correct" LLVM IR code, where by default we branch to an unreachable basic block.

I benchmarked this (possibly incorrectly) using nofib, and saw no increase or decrease in performance.

However, I still believe this should be upstreamed since it informs the LLVM optimizer about the possible values that will be branched upon.

Feedback on making the code better is greatly appreciated :)

Edited by Ben Gamari

Merge request reports