[llvm] [GVN] Permit load PRE to happen in more cases (PR #76063)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 08:00:35 PST 2023


https://github.com/nikic requested changes to this pull request.

> where PredLoads and CriticalEdgePredSplit are the lists of available and
unavailable loads, respectively.

This is incorrect. Both are lists of unavailable loads. The first one for unavailable loads that don't require critical edge splitting, and the second for ones that do.

> Therefore, with just one unavailable load we refuse to perform load PRE if there are other predecessors with available loads.

And this conclusion is thus also incorrect.

What the current check does it to make sure that the number of loads does not increase. We end up removing one load, and adding one load in an unavailable block.

Your new check says that instead we can insert an arbitrary number of loads in unavailable predecessors, as long as there is at least one available load (and we don't have to split more than one critical edge). This is not a reasonable heuristic.

https://github.com/llvm/llvm-project/pull/76063


More information about the llvm-commits mailing list