[all-commits] [llvm/llvm-project] 47f53e: [Mips] Add glue between CopyFromReg, CopyToReg and...

Jessica Clarke via All-commits all-commits at lists.llvm.org
Fri Oct 22 00:33:52 PDT 2021


  Branch: refs/heads/release/13.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 47f53eec648514daf87b9c0b1e1177bb8f7056ae
      https://github.com/llvm/llvm-project/commit/47f53eec648514daf87b9c0b1e1177bb8f7056ae
  Author: Jessica Clarke <jrtc27 at jrtc27.com>
  Date:   2021-10-22 (Fri, 22 Oct 2021)

  Changed paths:
    M llvm/lib/Target/Mips/MipsSEISelDAGToDAG.cpp
    M llvm/test/CodeGen/Mips/tls-static.ll

  Log Message:
  -----------
  [Mips] Add glue between CopyFromReg, CopyToReg and RDHWR nodes for TLS

The MIPS ABI requires the thread pointer be accessed via rdhwr $3, $r29.
This is currently represented by (CopyToReg $3, (RDHWR $29)) followed by
a (CopyFromReg $3). However, there is no glue between these, meaning
scheduling can break those apart. In particular, PR51691 is a report
where PseudoSELECT_I was moved to between the CopyToReg and CopyFromReg,
and since its expansion uses branches, it split the def and use of the
physical register between two basic blocks, resulting in the def being
eliminated and the use having no def. It also seems possible that a
similar situation could arise splitting up the CopyToReg from the RDHWR,
causing the RDHWR to use a destination register other than $3, violating
the ABI requirement.

Thus, add glue between all three nodes to ensure they aren't split up
during instruction selection. No regression test is added since any test
would be implictly relying on specific scheduling behaviour, so whilst
it might be testing that glue is preventing reordering today, changes to
scheduling behaviour could result in the test no longer being able to
catch a regression here, as the reordering might no longer happen for
other unrelated reasons.

Fixes PR51691.

Reviewed By: atanasyan, dim

Differential Revision: https://reviews.llvm.org/D111967

(cherry picked from commit f5755c0849a56543ef6938352784fdd7b4596e4c)




More information about the All-commits mailing list