[PATCH] [RFC] Lame fix for PR20376

Tim Northover t.p.northover at gmail.com
Tue Jul 22 10:00:29 PDT 2014


On 22 July 2014 17:24, Philip Reames <listmail at philipreames.com> wrote:
>> We actually do have a last-ditch EFLAGS copy available (though with
>> worrying implications for the red-zone, if we ever start using it). It's
>> used by test/CodeGen/Generic/2011-07-07-ScheduleDAGCrash.ll for example.
>
> Tim, could expand on this point a bit?

I'm afraid I forget who, but someone pointed it out to me on IRC the other day.

The AMD64 ABI says that the compiler is free to use 128 bytes below
%rsp for local variables (to avoid stack adjustment in small leaf
functions, I believe). So OS context-switches and interrupts have to
preserve that data, for example.

When we do need to copy EFLAGS, we currently emit a pushf/popw or
pushw/popf pair, which could clobber a local variable if we actually
made use of the red zone. I don't think we do though (fortunately).
There are apparently "lahf" and "sahf" we could use instead, if it
came to it (at least for our purposes).

Cheers.

Tim.



More information about the llvm-commits mailing list