Merge pull request #20580 from WalterBright/elstreq

optimize s=s where s is a struct
This commit is contained in:
Dennis 2024-12-19 21:40:08 +01:00 committed by GitHub
commit 16c013abb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 0 deletions

View file

@ -3521,6 +3521,13 @@ elem * elstruct(elem *e, Goal goal)
return optelem(e, goal);
}
// Replace (e = e) with (e, e)
if (e.Eoper == OPstreq && el_match(e.E1, e.E2))
{
e.Eoper = OPcomma;
return optelem(e, goal);
}
if (!e.ET)
return e;
//printf("\tnumbytes = %d\n", cast(int)type_size(e.ET));