Don't remove COPYs with implicit defs, unless we know the implicitly
defined register is also zero.
Details
- Reviewers
t.p.northover MatzeB junbuml mcrosier
Diff Detail
- Build Status
Buildable 3899 Build 3899: arc lint + arc unit
Event Timeline
Where do copies like that come from? It seems like a pretty sketchy target-specific extension to a shared instruction, and we should probably be representing that in some better way.
Indeed a COPY instruction does not necessarily clear the upper bits of a register, even if the targets move instruction to implement it does. This mostly comes from the fact that we are allowed to eliminate NOP copies when the source and target are the same, with the rule to clear the upper bits we would not longer be allowed to do so.
test/CodeGen/AArch64/machine-copy-remove.mir | ||
---|---|---|
24 | Why not adding the below case as well in the test ? %w0 = COPY %wzr, implicit-def %x0 |
Yeah, it looks like this was a false alarm. I spot checked some of the cases that were leading to these COPYs and all of them were of the form:
%vreg:sub_32<def,read-undef> = COPY %WZR
which don't expect to have the upper 32 bits cleared.
Why not adding the below case as well in the test ?