-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
#78191 fixes a bug in MatchBranchSimplification but causes it to create some "boilerplate". We should try to optimize it away again. One example is
- switchInt(_4) -> [false: bb7, otherwise: bb8];
+ StorageLive(_9);
+ _9 = _4;
+ _3 = Ne(_9, const false);
+ StorageDead(_9);
+ goto -> bb9;
for which we should make sure that copy prop still manages to remove _9
.
Other situations are
- switchInt(move _3) -> [false: bb11, otherwise: bb10];
+ StorageLive(_10);
+ _10 = move _3;
+ StorageDead(_3);
+ _1 = Ne(_10, const false);
+ StorageDead(_10);
+ goto -> bb12;
which are more complex. But since it is always safe (haha, uh, I think) to move a StorageDead
further down and a StorageLive
further up, we should be able to move the StorageDead(_3)
after _1 = Ne(_10, const false);
, thus allowing copy prop to handle this again.
Metadata
Metadata
Assignees
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.