dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.94k stars 4.64k forks source link

Implement loop peeling #93142

Open BruceForstall opened 11 months ago

BruceForstall commented 11 months ago

"Loop peeling" is a compiler optimization that unrolls a loop into two copies. In the variant of interest here, the first copy executes the first iteration of the loop, and the second copy executes the remaining iterations of the loop. Given the structure and semantics of .NET code, it is believed that peeling the first iteration will allow better optimization of the remaining iterations by constructing CSEs in the first copy in exception order, and using them in the second copy where exception checking such as null checking of arrays can be removed.

ghost commented 11 months ago

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch See info in area-owners.md if you want to be subscribed.

Issue Details
"Loop peeling" is a compiler optimization that unrolls a loop into two copies. In the variant of interest here, the first copy executes the first iteration of the loop, and the second copy executes the remaining iterations of the loop. Given the structure and semantics of .NET code, it is believed that peeling the first iteration will allow better optimization of the remaining iterations by constructing CSEs in the first copy in exception order, and using them in the second copy where exception checking such as null checking of arrays can be removed.
Author: BruceForstall
Assignees: -
Labels: `area-CodeGen-coreclr`
Milestone: 9.0.0