dotnet / dotnet/runtime

ValueTuple.Equals is not folded for constant strings

Open
#121,532 1 comment 0 reactions 0 assignees View on GitHub
area-CodeGen-coreclr
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

```cs
bool Test(string a) => (a, "123") == ("44", "5555");
```
Expected:
```asm
xor eax, eax
ret
```
Actual:
```asm
mov rax, 0x1E5C96450C8 ; '44'
cmp rdx, rax
je SHORT G_M49591_IG08
test rdx, rdx
je SHORT G_M49591_IG06
cmp dword ptr [rdx+0x08], 2
jne SHORT G_M49591_IG06
cmp dword ptr [rdx+0x0C], 0x340034
je SHORT G_M49591_IG08
G_M49591_IG06:
xor eax, eax
ret
G_M49591_IG08:
xor eax, eax
ret
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.