[PATCH] D150388: [CodeGen]Allow targets to use target specific COPY instructions for live range splitting

Yashwant Singh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 11:28:45 PDT 2023


yassingh created this revision.
Herald added subscribers: pengfei, dmgreen, atanasyan, jrtc27, hiraditya, tpr, sdardis, qcolombet, MatzeB.
Herald added a project: All.
yassingh requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Replacing D143754 <https://reviews.llvm.org/D143754>. Right now the LiveRangeSplitting during register allocation uses
TargetOpcode::COPY instruction for splitting. For AMDGPU target that creates a 
problem as we have both vector and scalar copies. Vector copies perform a copy over
a vector register but only on the lanes(threads) that are active. This is mostly sufficient
however we do run into cases when we have to copy the entire vector register and
not just active lane data. One major place where we need that is live range splitting.

Allowing targets to use their own copy instructions(if defined) will provide a lot of
flexibility and ease to lower these pseudo instructions to correct MIR.

- Introduce getTargetCopyOpcode() virtual function and use if to generate copy in Live range splitting.
- Replace necessary MI.isCopy() checks with TII.isCopyInstr() in register allocator pipeline.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150388

Files:
  llvm/include/llvm/CodeGen/TargetInstrInfo.h
  llvm/lib/CodeGen/CalcSpillWeights.cpp
  llvm/lib/CodeGen/InlineSpiller.cpp
  llvm/lib/CodeGen/LiveRangeEdit.cpp
  llvm/lib/CodeGen/LiveRangeShrink.cpp
  llvm/lib/CodeGen/RegAllocGreedy.cpp
  llvm/lib/CodeGen/SplitKit.cpp
  llvm/lib/CodeGen/TargetInstrInfo.cpp
  llvm/test/CodeGen/Mips/madd-msub.ll
  llvm/test/CodeGen/Thumb2/mve-float32regloops.ll
  llvm/test/CodeGen/X86/GlobalISel/add-ext.ll
  llvm/test/CodeGen/X86/dagcombine-cse.ll
  llvm/test/CodeGen/X86/fold-and-shift-x86_64.ll
  llvm/test/CodeGen/X86/unfold-masked-merge-scalar-constmask-lowhigh.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150388.521385.patch
Type: text/x-patch
Size: 20232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230511/4e7a6dde/attachment.bin>


More information about the llvm-commits mailing list