This is an archive of the discontinued LLVM Phabricator instance.

Fix for PR29010
ClosedPublic

Authored by myatsina on Aug 17 2016, 10:23 AM.

Details

Summary

This is a fix for https://llvm.org/bugs/show_bug.cgi?id=29010
Root cause of the bug is that the register class of the machine instruction operand does not fully reflect if this registers that can be allocated.
Both for i386 and x86_64 the operand's register class is VR128RegClass and thus contains xmm0-xmm15, though in i386 we can only use xmm0-xmm8.
In order to get the actual allocable registers of the class we need to use RegisterClassInfo.

Diff Detail

Repository
rL LLVM

Event Timeline

myatsina updated this revision to Diff 68377.Aug 17 2016, 10:23 AM
myatsina retitled this revision from to Fix for PR29010.
myatsina updated this object.
myatsina added a reviewer: mkuper.
myatsina set the repository for this revision to rL LLVM.
myatsina added a subscriber: abadams.
myatsina updated this revision to Diff 68382.Aug 17 2016, 10:27 AM

Adding test case

mkuper accepted this revision.Aug 17 2016, 11:22 AM
mkuper edited edge metadata.

LGTM, except for a nit in the test.

test/CodeGen/X86/pr29010.ll
1 ↗(On Diff #68382)

Why do you need -mcpu? Shouldn't -mattr be enough?

This revision is now accepted and ready to land.Aug 17 2016, 11:22 AM
myatsina added inline comments.Aug 17 2016, 11:40 AM
test/CodeGen/X86/pr29010.ll
1 ↗(On Diff #68382)

Copy paste from another test :) I'll remove it

This revision was automatically updated to reflect the committed changes.
MatzeB added a subscriber: MatzeB.Oct 28 2016, 2:23 PM

Wouldn't it be easier to test MachineRegisterInfo::isAllocatable() instead of constructing a whole RegisterClassInfo object just for this one place?