Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[interp] Fold "ldstr".Length to a constant #20523

Closed

Conversation

monojenkins
Copy link
Contributor

!! This PR is a copy of dotnet/runtime#43945, please do not edit or review it in this repo !!
Do not automatically approve this PR:

* Consider how the changes affect configurations in this repo,
* Check effects on files that are not mirrored,
* Identify test cases that may be needed in this repo.

!! Merge the PR only after the original PR is merged !!



A similar optimization for RyuJIT was quite profitable judging by the jit-diff: dotnet/runtime#1378

Example:

static int Test()
{
    return "hello".Length;
}

Current MONO_VERBOSE_METHOD=Test output:

IR_0000: ldstr      0
IR_0002: strlen
IR_0003: ret

New output:

IR_0000: ldc.i4.5
IR_0001: ret

A similar optimization for RyuJIT was quite profitable judging by the jit-diff: dotnet/runtime#1378

Example:
```csharp
static int Test()
{
    return "hello".Length;
}
```
Current `MONO_VERBOSE_METHOD=Test` output:
```
IR_0000: ldstr      0
IR_0002: strlen
IR_0003: ret
```
New output:
```
IR_0000: ldc.i4.5
IR_0001: ret
```
@EgorBo
Copy link
Member

EgorBo commented Oct 30, 2020

@monojenkins build failed

@akoeplinger
Copy link
Member

The mirror was disabled, closing.

@akoeplinger akoeplinger closed this Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants