[all-commits] [llvm/llvm-project] cf7cda: [X86][VARARG] Avoid spilling xmm registers for va_...

avl-llvm via All-commits all-commits at lists.llvm.org
Sat Mar 6 04:30:32 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cf7cdaff64fb2a97f9af533ad0a5ed9c94b72c8e
      https://github.com/llvm/llvm-project/commit/cf7cdaff64fb2a97f9af533ad0a5ed9c94b72c8e
  Author: Alexey Lapshin <a.v.lapshin at mail.ru>
  Date:   2021-03-06 (Sat, 06 Mar 2021)

  Changed paths:
    M llvm/lib/Target/X86/X86ExpandPseudo.cpp
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.h
    M llvm/lib/Target/X86/X86InstrCompiler.td
    M llvm/test/CodeGen/X86/musttail-varargs.ll
    M llvm/test/CodeGen/X86/vastart-defs-eflags.ll
    M llvm/test/CodeGen/X86/x32-va_start.ll
    M llvm/test/CodeGen/X86/x86-64-varargs.ll
    A llvm/test/CodeGen/X86/xmm-vararg-noopt.ll

  Log Message:
  -----------
  [X86][VARARG] Avoid spilling xmm registers for va_start.

That review is extracted from D69372.
It fixes https://bugs.llvm.org/show_bug.cgi?id=42219 bug.

For the noimplicitfloat mode, the compiler mustn't generate
floating-point code if it was not asked directly to do so.
This rule does not work with variable function arguments currently.
Though compiler correctly guards block of code, which copies xmm vararg
parameters with a check for %al, it does not protect spills for xmm registers.
Thus, such spills are generated in non-protected areas and could break code,
which does not expect floating-point data. The problem happens in -O0
optimization mode. With this optimization level there is used
FastRegisterAllocator, which spills virtual registers at basic block boundaries.
Register Allocator does not protect spills with additional control-flow modifications.
Thus to resolve that problem, it is suggested to not copy incoming physical
registers into virtual registers. Instead, store incoming physical xmm registers
into the memory from scratch.

Differential Revision: https://reviews.llvm.org/D80163




More information about the All-commits mailing list