Skip to content

Commit

Permalink
Auto merge of #128265 - DianQK:instsimplify-before-inline, r=saethlin
Browse files Browse the repository at this point in the history
 Perform instsimplify before inline to eliminate some trivial calls

I am currently working on #128081. In the current pipeline, we can get the following clone statements ([godbolt](https://rust.godbolt.org/z/931316fhP)):

```
    bb0: {
        StorageLive(_2);
        _2 = ((*_1).0: i32);
        StorageLive(_3);
        _3 = ((*_1).1: u64);
        _0 = Foo { a: move _2, b: move _3 };
        StorageDead(_3);
        StorageDead(_2);
        return;
    }
```

Analyzing such statements will be simple and fast. We don't need to consider branches or some interfering statements. However, this requires us to run `InstSimplify`, `ReferencePropagation`, and `SimplifyCFG` at least once. I can introduce a new pass, but I think the best place for it would be within `InstSimplify`.

I put `InstSimplify` before `Inline`, which takes some of the burden away from `Inline`.

r? `@saethlin`
  • Loading branch information
bors committed Jul 29, 2024
2 parents d3c2b59 + d60d8f2 commit 7ca96fa
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 7ca96fa

Please sign in to comment.