[llvm-dev] Tuning CSRCost for shrink-wrapping
via llvm-dev
llvm-dev at lists.llvm.org
Tue Aug 8 09:20:22 PDT 2017
Hi,
I often observed missing shrink-wrapping opportunities. For example,
when compiling below C code with -O3 for AArach64, I saw that Clang
placed the spills of CSRs in the entry block, while GCC shrink-wrapped
the spills of CSRs from the entry block.
int getI(int i);
int foo(int *P, int i) {
if (i>0)
return P[i];
i = getI(i);
return P[i];
}
I believe this is because the current CSRCost fixed in RegAllocGreedy is
too conservative. In most cases we allocate a CSR rather than splitting
ranges when the live range is across a call. In
https://reviews.llvm.org/D34608, I tried to increase the CSRCost to
defer the allocation of CSR with the hope of more shrink-wrapping.
However, I'm not convinced it's really right approach to handle the
problem. If you have any thoughts on this issue, I would love to hear
your feedback.
Thanks,
Jun
--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a
Linux Foundation Collaborative Project.
More information about the llvm-dev
mailing list