This is an archive of the discontinued LLVM Phabricator instance.

[X86] Fix Windows `i1 zeroext` conventions to use i8 instead of i32
ClosedPublic

Authored by rnk on Mar 26 2018, 10:32 AM.

Details

Summary

Re-lands r328386 and r328443, reverting r328482.

Incorporates fixes from @mstorsjo in D44876 (thanks!) so that small
parameters in i8 and i16 do not end up in the SysV register parameters
(EDI, ESI, etc).

I added tests for how we receive small parameters, since that is the
important part. It's always safe to store more bytes than will be read,
but the assumptions you make when loading them are what really matter.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.Mar 26 2018, 10:32 AM
mstorsjo accepted this revision.Mar 26 2018, 10:55 AM

LGTM.

As I wrote in http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180319/536996.html, it also seems like the same issue is present for non-windows calling conventions, although I guess that's a separate issue.

This revision is now accepted and ready to land.Mar 26 2018, 10:55 AM
rnk added a comment.Mar 26 2018, 11:06 AM

LGTM.

As I wrote in http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180319/536996.html, it also seems like the same issue is present for non-windows calling conventions, although I guess that's a separate issue.

I think you're right, GCC (on Linux) emits those sign/zero extensions, but LLVM does not: https://godbolt.org/g/yqNXp7 This must have been an intentional decision, but I can find no evidence for it in the SysV ABI doc.

rnk added a comment.Mar 26 2018, 11:41 AM

I'm self-hosting clang on win64 to validate this a little more, btw.

This revision was automatically updated to reflect the committed changes.