[PATCH] D20531: MachineCopyPropagation: remove some more copys when they are not needed

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 17:52:28 PDT 2016


MatzeB added a comment.

Hi Jonas,

I just realized that I was working on pretty much the same thing (d'oh). I just didn't realize at first as I had a different motivation: When I change:

  %x = COPY %y
    use %x

to

  %x = COPY %y
    use %y

then both instructions can be scheduled independently by the post-ra scheduler.

As Quentin already mentioned it is indeed sketchy to rename physregs as it is not clear whether there are additional architectural constraints forcing the use of a specific register. While ABI constraints should not be touched (because you MCInstrDesc doesn't specify a register class for those implicit def and use operands), this still doesn't universally work.

In my experiments the renaming was fine on aarch64, but AMDGPU for example breaks after renaming because apparently some physregs cannot be used multiple times on the same instruction.
A fact that is not visible to the MachineCopyPropagation pass. I "solved" this by requiring the target to explicitely opt-in to the behaviour for now.

I'll upload my version shortly for reference after incorporating some of the things you did here.


http://reviews.llvm.org/D20531





More information about the llvm-commits mailing list