Page MenuHomePhabricator

[X86] Fix stack probing on x32 (PR41477)
ClosedPublic

Authored by nikic on Apr 19 2019, 11:51 AM.

Details

Summary

Fix for https://bugs.llvm.org/show_bug.cgi?id=41477. On the x32 ABI with stack probing a dynamic alloca will result in a WIN_ALLOCA_32 with a 32-bit size. The current implementation tries to copy it into RAX, resulting in a physreg copy error. Fix this by copying to EAX instead.

Diff Detail

Event Timeline

nikic created this revision.Apr 19 2019, 11:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2019, 11:51 AM
efriedma added inline comments.
llvm/lib/Target/X86/X86WinAllocaExpander.cpp
242–243

Are you sure this subtraction is using the right opcode?

260–261

Also the subtraction here.

llvm/test/CodeGen/X86/pr41477.ll
18

subq is the wrong opcode; should be using subl.

nikic updated this revision to Diff 195899.Apr 19 2019, 12:54 PM

Fix more registers/opcodes.

nikic marked 3 inline comments as done.Apr 19 2019, 1:00 PM

Thanks @efriedma. I've added test cases that exercise all three codepaths now and fixed the subtract regs/ops.

This revision is now accepted and ready to land.Apr 19 2019, 1:36 PM
nikic closed this revision.Apr 20 2019, 3:18 AM

Committed in rL358807, forgot the Differential Revision tag...