[PATCH] D34608: [WIP][AArch64] Increase CSR cost when defering use of CSR is preferred

Jun Bum Lim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 14:11:27 PDT 2017


junbuml updated this revision to Diff 109629.
junbuml retitled this revision from "[AArch64] Increase CSR cost when defering use of CSR is preferred" to "[WIP][AArch64] Increase CSR cost when defering use of CSR is preferred".
junbuml added a comment.

Kindling ping. Please let me know any comment or suggestion regarding this change.

I believe the current CSRCost fixed in initializeCSRCost() is very conservative. In most case, we allocate a CSR rather than split ranges. However, in some situation  (e.g, when none of user blocks of a LR has a function call), we should have more possibility to split the range because if we allocate a CSR too early, the CSR would not be accessed in some paths even after spilling it in the entry block. When we properly defer the use of CSR we might expose more shrink wrapping opportunities.

In this change, I treated the cost of spilt as the frequencies of the copies at the related spots while the cost of using the CSR is equivalent to the first spill in the entry block. Based on that, if none of user blocks of the LR has a function call, I increased the CSR cost by multiplying the frequency of the entry block with a fixed weight factor for the spill of the first CSR as we compare the cost between copies and the spill of CSRs.


https://reviews.llvm.org/D34608

Files:
  include/llvm/Target/TargetLowering.h
  lib/CodeGen/RegAllocGreedy.cpp
  lib/Target/AArch64/AArch64ISelLowering.cpp
  lib/Target/AArch64/AArch64ISelLowering.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34608.109629.patch
Type: text/x-patch
Size: 8500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170803/52bebdba/attachment.bin>


More information about the llvm-commits mailing list