[PATCH] D36224: [TwoAddressInstructionPass] Replace subregister uses when processing tied operands

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 27 08:01:00 PDT 2018


bjope added a reviewer: MatzeB.
bjope added a comment.

In https://reviews.llvm.org/D36224#1246786, @bjope wrote:

> I'm actually not sure if this should impact the update of liveness info. LV is deprecated and should not be used after this pass (so I don't know if it really need to be updated). And everything about LIS here is unused code unless using -early-live-intervals. And we do not have any tests for that (and when I tried -early-live-intervals I got lots of other failures). Anyway, since https://reviews.llvm.org/rL279804 did not change anything about liveness info, I guess a revert of https://reviews.llvm.org/rL279804 should not impact it either.


I've looked a little bit more at this and if I add "-run-pass livevars" to make LiveVariables come into play, and also add "-verify-machineinstrs" then the result for "test2" will be:

  # After Two-Address instruction pass
  # Machine code for function test2: NoPHIs, TracksLiveness
  
  bb.0.entry:
    liveins: $d0
    %0:doubleregs = COPY killed $d0
    %1:intregs = COPY killed %0.isub_lo:doubleregs
    dead %1:intregs = S2_lsr_i_r_acc %1:intregs(tied-def 0), %0.isub_hi:doubleregs, 16
  
  # End machine code for function test2.
  
  *** Bad machine code: Using a killed virtual register ***
  - function:    test2
  - basic block: %bb.0 entry (0x5c773b8)
  - instruction: dead %1:intregs = S2_lsr_i_r_acc %1:intregs(tied-def 0), %0.isub_hi:doubleregs, 16
  - operand 2:   %0.isub_hi:doubleregs
  LLVM ERROR: Found 1 machine code errors.

I've been told that "dead" markings on subreg defs only tell that the subreg is dead, not the full register. Is it the same for "killed"? 
If so, then I'd assume that this is a verifier bug. Otherwise we need to remove `killed %0.isub_lo` from the COPY instruction here.

PS. Another thing is that we do not get `killed` on the `%0.isub_hi` use in the `S2_lsr_i_r_acc` in the result. But we do not even get that out from LiveVariables, so maybe we should not blame TwoAddressInstructionPass for that.


Repository:
  rL LLVM

https://reviews.llvm.org/D36224





More information about the llvm-commits mailing list