[llvm-dev] llvm-reduce for MIR

89 views
Skip to first unread message

Markus Lavin via llvm-dev

unread,
Aug 17, 2021, 5:04:36 AM8/17/21
to llvm-dev

Has anyone thought about extending llvm-reduce to also be able to do reduction on MIR?

 

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?

 

-Markus

Quentin Colombet via llvm-dev

unread,
Aug 17, 2021, 4:08:22 PM8/17/21
to Markus Lavin, llvm-dev
Hi Markus,

On Aug 17, 2021, at 2:04 AM, Markus Lavin via llvm-dev <llvm...@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 :).
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...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Arthur Eubanks via llvm-dev

unread,
Aug 17, 2021, 6:08:02 PM8/17/21
to Quentin Colombet, llvm-dev
+1, this would be a cool addition to llvm-reduce.

Markus Lavin via llvm-dev

unread,
Sep 28, 2021, 4:57:31 AM9/28/21
to Arthur Eubanks, Quentin Colombet, llvm-dev
So to report back to this thread.

I went ahead and did something https://reviews.llvm.org/D110527

If anyone is interested feel free to add yourselves as reviewer.

-Markus

From: Arthur Eubanks <aeub...@google.com>
Sent: den 18 augusti 2021 00:08
To: Quentin Colombet <qcol...@apple.com>
Cc: Markus Lavin <markus...@ericsson.com>; llvm-dev <llvm...@lists.llvm.org>
Subject: Re: [llvm-dev] llvm-reduce for MIR

+1, this would be a cool addition to llvm-reduce.

On Tue, Aug 17, 2021 at 1:08 PM Quentin Colombet via llvm-dev <mailto:llvm...@lists.llvm.org> wrote:
Hi Markus,


mailto:llvm...@lists.llvm.org
https://protect2.fireeye.com/v1/url?k=0528e208-5ab3db39-0528a293-86e2237f51fb-7364d6345fc306d7&q=1&e=a4b84571-8b4a-495a-897e-364168be80ed&u=https%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-dev

_______________________________________________
LLVM Developers mailing list
mailto:llvm...@lists.llvm.org
https://protect2.fireeye.com/v1/url?k=e73b4d67-b8a07456-e73b0dfc-86e2237f51fb-744529c322f89b86&q=1&e=a4b84571-8b4a-495a-897e-364168be80ed&u=https%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-dev
Reply all
Reply to author
Forward
0 new messages