[PATCH] D17652: [CGP] Duplicate addressing computation in cold paths if required to sink addressing mode

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 11:09:59 PST 2016


reames created this revision.
reames added reviewers: sanjoy, davidxl, hfinkel, qcolombet, joker.eph, chandlerc.
reames added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.

This patch teaches CGP to duplicate addressing mode computations into cold paths (detected via explicit cold attribute on calls) if required to let addressing mode be safely sunk into the basic block containing each load and store.  

In general, duplicating code into cold blocks may result in code growth, but should not effect performance.  In this case, it's better to duplicate some code than to put extra pressure on the register allocator by making it keep the address through the entirely of the fast path.  

This patch only handles addressing computations, but in principal, we could implement a more general cold cold scheduling heuristic which tries to reduce register pressure in the fast path by duplicating code into the cold path.  Getting the profitability of the general case right seemed likely to be challenging, so I stuck to the existing case (addressing computation) we already had.  

http://reviews.llvm.org/D17652

Files:
  lib/CodeGen/CodeGenPrepare.cpp
  test/Transforms/CodeGenPrepare/X86/sink-addrmode.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17652.49209.patch
Type: text/x-patch
Size: 9684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160226/72493d67/attachment.bin>


More information about the llvm-commits mailing list