[PATCH] D43214: [X86] Use EDI for retpoline when no scratch regs are left

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 12:49:00 PST 2018


rnk added a comment.

In https://reviews.llvm.org/D43214#1006013, @chandlerc wrote:

> So, if I understand correctly, this prevents the use of `-mregparm=3`, 32-bit x86, and a caller-save-all calling convention. And the reason this is reliable is because LLVM doesn't have such a calling convention (except maybe AnyReg) and if someone even managed to craft such IR they would just hit the assert and have to extend this? And we believe Clang definitively cannot create such a calling convention?
>
> I'm not doubting anything here, I'm repeating to check my understanding. =]


Yes, there may be 32-bit CCs that can use all of EAX, EDX, ECX, and EDI, but I don't think it's worth trying to support retpolining indirect calls of such conventions. The same problem may exist on x64 if someone adds a convention that uses https://reviews.llvm.org/source/libunwind/. We're just assuming they wouldn't because such a convention won't work when there's a PLT trip involved. I strengthened the assert to a conditional report_fatal_error, so we will fail reliably in these unsupported scenarios.

> Provided I've understood correctly, LGTM, let's get this in testing.

Sounds good. I will try to merge this to 6.0 and 5.0.


https://reviews.llvm.org/D43214





More information about the llvm-commits mailing list