[llvm-dev] llvm-reduce for MIR

Quentin Colombet via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 17 13:08:09 PDT 2021


Hi Markus,

> On Aug 17, 2021, at 2:04 AM, Markus Lavin via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Has anyone thought about extending llvm-reduce to also be able to do reduction on MIR?

Thought about it, yes, doing anything about it, no :).

>  
> The current tool itself seems quite modular and nicely structured with the delta-algorithm separated from the actual IR specific reductions.
> When reducing IR instructions (ReduceInstructions.cpp) it just does RAUW undef and then eraseFromParent so in theory it seems it would be possible to do a similar thing for MIR. At least while on SSA form one could either RAUW $noreg or perhaps a dominating definition of the same register class. So maybe it would not be too much work to add a set of MIR specific reducers (at least for MBB and MI) and generalize the remaining part of the tool (module import and verification) to able to handle both IR and MIR.
>  
> At least for me manually reducing MIR is quite slow an painful so any automation here would be appreciated.
>  
> Of course in general MIR is more constrained that IR so it may be “a bit” more complicated than outlined here, but still seems worth a try.
>  
> Any thoughts on this?

Having such tool would be super useful!

On a somewhat related note, I built a tool to extract a basic block from MIR (i.e., like llvm-extract but on MIR). I’ve never bothered cleaning it up and open sourcing it, but if there is interest for that I could certainly push that out.

Cheers,
-Quentin

>  
> -Markus
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210817/ea9ba699/attachment.html>


More information about the llvm-dev mailing list