google / souper

A superoptimizer for LLVM IR

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handling replaced instructions that failed the dominance checks

mshockwave opened this issue · comments

Hi,
In SouperPass, if a RHS replacement already has Origins (i.e. associated LLVM Values), the pass will try to reuse it. Before applying the replacement LLVM Instructions, it will check if the Instructions dominate our replacement point.
However, if it fails, it will just bail out the whole process and return an replacement failure. I'm wondering if we can simply create another LLVM instruction (and attach to the corresponding Souper Inst) that dominates the replacement point instead.
Thank you.

Hi,

Ran into the same issue. Would be nice to have a fix for that or at least a switch where you can force the generation of a new instruction if the dominance check fails.

Thanks

Yeah, I can see putting this behind a switch. It doesn't want to be on by default since when we do this, the old instruction isn't going to get deleted, so we'll often end up increasing code size. I can't work on this for another few weeks, but after that I should have time. Thanks.