Currently, we would generate an array, store that, calculate the offset with a GEP and then load from the GEP.
LLVM does an awful job optimizing this (potentially due to missing alias info or so).
That's why I initially resorted to actually using if/else in the regex impl, but that is also not optimized too neatly.
Therefore, I added a specialization for 2-element integral tuples (yeah, should work for a bunch of other types as well), to emit a select instruction instead.
On the regex benchmark, this gives a performance upgrade of ~14% speedup, leaving only a 13% slowdown compared to the manual version.
Old:
Currently, we would generate an array, store that, calculate the offset with a GEP and then load from the GEP. LLVM does an awful job optimizing this (potentially due to missing alias info or so). That's why I initially resorted to actually using if/else in the regex impl, but that is also not optimized too neatly. Therefore, I added a specialization for 2-element integral tuples (yeah, should work for a bunch of other types as well), to emit a
select
instruction instead.On the regex benchmark, this gives a performance upgrade of ~14% speedup, leaving only a 13% slowdown compared to the manual version. Old:
New: