This is an archive of the discontinued LLVM Phabricator instance.

[InlineAsm] Update the min-legal-vector-width function attribute based on inputs and outputs to inline assembly
ClosedPublic

Authored by craig.topper on Aug 13 2018, 4:42 PM.

Details

Summary

Another piece of my ongoing to work for prefer-vector-width.

min-legal-vector-width will eventually be used by the X86 backend to know whether it needs to make 512 bits type legal when prefer-vector-width=256. If the user used inline assembly that passed in/out a 512-bit register, we need to make sure 512 bits are considered legal. Otherwise we'll get an assert failure when we try to wire up the inline assembly to the rest of the code.

This patch just checks the LLVM IR types to see if they are vectors and then updates the attribute based on their total width. I'm not sure if this is the best way to do this or if there's any subtlety I might have missed. So if anyone has other opinions on how to do this I'm open to suggestions.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 13 2018, 4:42 PM

This makes sense to me, but definitely wait for someone more familiar w/ Clang's IR gen to review...

rnk accepted this revision.Aug 13 2018, 6:24 PM

lgtm

This revision is now accepted and ready to land.Aug 13 2018, 6:24 PM
This revision was automatically updated to reflect the committed changes.