Stream: t-compiler/wg-mir-opt

Topic: Dead Store Elimination


Jonas Schievink (May 24 2020 at 19:42, on Zulip):

Do we have a pass that can eliminate stores that are never read? Const prop can leave a lot of those behind when it runs.

Matthew Jasper (May 24 2020 at 19:45, on Zulip):

SimplifyLocals does a rather naive form of DSE

Matthew Jasper (May 24 2020 at 19:47, on Zulip):

Specifically it removes stores to locals where the local is never read, rather than where the stored value is never read.

Jonas Schievink (May 24 2020 at 19:48, on Zulip):

Ah I see, that should already help

ecstatic-morse (May 24 2020 at 21:52, on Zulip):

More robust DSE is one of the things I wanted to implement now that intrablock liveness is easy to compute.

ecstatic-morse (May 24 2020 at 22:20, on Zulip):

I think I'll work on that next week.

Wesley Wiser (May 25 2020 at 01:14, on Zulip):

Somewhat related, I'm working on being able to remove locals that are only used for debug info while still preserving the debug info data.

Simon Vandel Sillesen (Jul 22 2020 at 17:24, on Zulip):

Hi! I played around with the playground, looking for simple MIR optimizations. In this code https://play.rust-lang.org/?version=nightly&mode=release&edition=2018&gist=5e51319bc039ba93e4006ce775988439 "x" is const so no side effects and completely dead. It is however not removed.

I'm reviving this topic as that seems to be the "more robust DSE" being talked about. Any progress on that @ecstatic-morse , @Wesley Wiser ? If not, I could be interested in giving a (simple) pass a shot. Would this fit inside SimplifyLocals, or should it be pulled out into a separate dead-code-elimination pass?

Wesley Wiser (Jul 22 2020 at 17:27, on Zulip):

Hi @Simon Vandel Sillesen! I've actually got a PR up that's waiting to merge that resolves that https://github.com/rust-lang/rust/pull/73210

Wesley Wiser (Jul 22 2020 at 17:28, on Zulip):

(The thing that's causing x to hang around is because it's being used by debuginfo)

Simon Vandel Sillesen (Jul 22 2020 at 19:57, on Zulip):

Alright, that sounds good!

Wesley Wiser (Jul 22 2020 at 19:59, on Zulip):

If you're looking for an optimization to work on, I think @oli has some "beginner" ones in mind :slight_smile:

Last update: Sep 28 2020 at 16:45UTC