Page MenuHomePhabricator

[X86][VARARG] Avoid spilling xmm registers for va_start.
Needs ReviewPublic

Authored by avl on May 18 2020, 2:24 PM.



That review is extracted from D69372.
It fixes 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.

Diff Detail

Event Timeline

avl created this revision.May 18 2020, 2:24 PM
aeubanks resigned from this revision.May 26 2020, 10:14 AM

not knowledgeable enough on this