This is an archive of the discontinued LLVM Phabricator instance.

[X86] Apply the new instruction's register classes constraints on the operands of the replaced instruction when memory folding
AbandonedPublic

Authored by aymanmus on Apr 30 2017, 6:13 AM.

Details

Summary

When performing memory folding (thus changing the register form of an instruction to it's memory form), make sure the register classes of the machine operands of the replaced instruction comply to the constrains of the register classes of the new instruction - If not, change them.

Diff Detail

Event Timeline

aymanmus created this revision.Apr 30 2017, 6:13 AM
craig.topper edited edge metadata.Apr 30 2017, 10:30 AM

Test case?

RKSimon added inline comments.
lib/Target/X86/X86InstrInfo.cpp
7713

for (unsigned i = 0, e = MOs.size(); i < e; i++) {

@craig.topper, i encountered this issue by coincidence but could not find a test case which fails without this. all the folded instructions right now have the same register classes constrains for both register and memory forms.
But as we entirely replace the instruction I saw that this change should be added even though it doesn't effect anything right now. Maybe it will be needed in the future.

aymanmus updated this revision to Diff 97614.May 3 2017, 5:31 AM

@craig.topper, i encountered this issue by coincidence but could not find a test case which fails without this. all the folded instructions right now have the same register classes constrains for both register and memory forms.
But as we entirely replace the instruction I saw that this change should be added even though it doesn't effect anything right now. Maybe it will be needed in the future.

Will test cases appear after D32684 is applied?

aymanmus abandoned this revision.Oct 23 2017, 1:25 AM

Abandoning - lack of response.