[llvm-dev] Register spilling in caller saved backend
Quentin Colombet via llvm-dev
llvm-dev at lists.llvm.org
Tue Sep 1 09:06:48 PDT 2015
Hi Jacques,
Could you attach the MachineInstr before and after register allocation?
This is hard to give an answer without seeing the actual CFG and live-ranges.
Thanks,
Q.
> On Sep 1, 2015, at 8:52 AM, Jacques Pienaar via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> Hey,
>
> I'm playing around with a backend with no callee saved registers and noticed more spilling than seems needed. I tried digging into the spilling code but with limited success. I also tried removing all the callee saved registers in the X86 backend and saw the same effect (basically making CSRs equal to CSR_NoRegs). So I seem to be misunderstanding something or missing something simple, and thought I'd ask.
>
> Consider this program as an example:
>
> volatile int x;
>
> int __attribute__((noinline)) foo() { return x; }
>
> int main() {
> for (int i = 0; i < 10; ++i) {
> foo();
> }
> }
>
> The resultant output code spills 'i' within the loop (I have to compile with -fno-unroll-loops else the loop and 'i' gets optimized away) while 'i' is assigned to a register that is used nowhere else in the generated program and I would consider 'foo' easy to analyse. At the call site of 'foo' the debugging output reports that the stack pointer and return value registers are "imp-use" and "imp-def" and no other registers are used.
>
> Should the spilling have occurred? Or this due to some feature in the backend that is missing?
>
> Thanks,
>
> Jacques
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the llvm-dev
mailing list