Closed Quuxplusone closed 7 years ago
Attached tc_rafast.ll
(3004 bytes, text/plain): reduced testcase
Please note this was found on SystemZ (-mtriple=s390x-linux-gnu), and I haven't checked if it is triggered on any other target.
I am not saying we shouldn't fix the problem, but you're using a configuration that is not well tested. You run the fast regalloc in optimized mode, i.e., with potentially complicated live-ranges. In particular, it is not unlikely that the fast regalloc does not set the proper undef flags when sub registers are used.
In other words, if you want to workaround the problem use the fast regalloc only in O0 (or at least with coalescing disabled -join-liveintervals=false).
I'd argue the problem is that we wrongly add a kill flag on the implicit use on
that instruction:
%R0L<def> = COPY %R1L, %R0Q<imp-use,kill>
Looking.
I talked with Matthias and he said that with subreg liveness we usually put
both the implicit-use and implicit-def.
So instead of not setting the kill flag, the proper fix would be to add an
implicit-def of the full register.
Putting my thoughts here.
Actually, looking closer at the issue, I am back to my original though that we
shouldn't set the kill in that example.
The implicit-use + implicit-def trick makes sense only if they happen on the
same instruction, which is the case in the example, but is wrong if the last-
use since this new definition is far appart.
E.g.,
%R0L<def> = COPY %R1L, %R0Q<imp-use,kill>, %R0Q<imp-def>
Is fine and makes sense, but
... = OP1 %R1L, %R0Q<imp-use,kill>
[...]
%R0L<def> = OP2 ... %R0Q<imp-def>
Is not fine and potentially dangerous because one would be able to reuse R1L
between OP1 and OP2.
Anyhow, going to remove the kill flags when subreg are involved. That's going
to be conservatively correct.
Remove the wrong kill flag as r307428.
Thanks for the report.
tc_rafast.ll
(3004 bytes, text/plain)