Open
Description
Currently, LLVM generates an additional jump for interpreters, which could be inclined for better performance. (which is how interpreters written in Assembly like LuaJIT's interpreter work).
Example:
define i32 @example() {
dispatch:
; dispatch logic
br {instruction}
instruction1:
; instruction logic
br label %dispatch
instruction2:
; instruction logic
br label %dispatch
}
But a faster version inlines logic from dispatch into instructions, and usually runs faster.
define i32 @example() {
; dispatch logic
br {instruction}
instruction1:
; instruction logic
; dispatch logic
br {instruction}
instruction2:
; instruction logic
; dispatch logic
br {instruction}
}
But this is also a small optimization for a small amount of programs, and maybe better suited for a plugin.