[PATCH] D80163: [X86][VARARG] Avoid spilling xmm registers for va_start.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 18 14:39:27 PDT 2020


avl created this revision.
avl added reviewers: craig.topper, RKSimon, rnk, aeubanks.
avl added a project: LLVM.
Herald added a subscriber: hiraditya.

That review is extracted from D69372 <https://reviews.llvm.org/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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80163

Files:
  llvm/lib/Target/X86/X86ExpandPseudo.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86ISelLowering.h
  llvm/lib/Target/X86/X86InstrCompiler.td
  llvm/test/CodeGen/X86/musttail-varargs.ll
  llvm/test/CodeGen/X86/vastart-defs-eflags.ll
  llvm/test/CodeGen/X86/x32-va_start.ll
  llvm/test/CodeGen/X86/xmm-vararg-noopt.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80163.264722.patch
Type: text/x-patch
Size: 23283 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200518/4b334996/attachment.bin>


More information about the llvm-commits mailing list