There's a piece of code in the XARCH emitter that attempts to remove LEA reg, [reg+0] instructions: https://github.com/dotnet/coreclr/blob/4c669eb9ed4400e636d1421412062aa99ccc0dda/src/jit/emitxarch.cpp#L5222
This works fine but such LEAs should not be generated in the first place.
In one such case I looked at, the LEA was generated by Lowering::TryCreateAddrMode from an ADD x, 0. How this ADD was created is another story but lowering should simply remove it, not create an address mode from it.
Initially discussed in dotnet/coreclr#27035 (comment)
category:cq
theme:optimization
skill-level:beginner
cost:medium
There's a piece of code in the XARCH emitter that attempts to remove
LEA reg, [reg+0]instructions: https://github.com/dotnet/coreclr/blob/4c669eb9ed4400e636d1421412062aa99ccc0dda/src/jit/emitxarch.cpp#L5222This works fine but such LEAs should not be generated in the first place.
In one such case I looked at, the LEA was generated by
Lowering::TryCreateAddrModefrom anADD x, 0. How thisADDwas created is another story but lowering should simply remove it, not create an address mode from it.Initially discussed in dotnet/coreclr#27035 (comment)
category:cq
theme:optimization
skill-level:beginner
cost:medium