7

Deduplicate unreachable blocks, for real this time by saethlin · Pull Request #1...

 1 year ago
source link: https://github.com/rust-lang/rust/pull/110569
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Conversation

Contributor

In #106428 (in particular 41eda69) we noticed that inlining unreachable_unchecked can produce duplicate unreachable blocks. So we improved two MIR optimizations: SimplifyCfg was given a simplify to deduplicate unreachable blocks, then InstCombine was given a combiner to deduplicate switch targets that point at the same block. The problem is that change doesn't actually work.

Our current pass order is

SimplifyCfg (does nothing relevant to this situation)
Inline (produces multiple unreachable blocks)
InstCombine (doesn't do anything here, oops)
SimplifyCfg (produces the duplicate SwitchTargets that InstCombine is looking for)

So in here, I have factored out the specific function from InstCombine and placed it inside the simplify that produces the case it is looking for. This should ensure that it runs in the scenario it was designed for.

Fixes #110551
r? @cjgillot

WaffleLapkin reacted with heart emoji

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK