This is an archive of the discontinued LLVM Phabricator instance.

Fix RegMask calculation for alias registers
ClosedPublic

Authored by vivekvpandya on Jul 14 2016, 10:32 PM.

Details

Summary

This patch fixes a very subtle bug in regmask calculation. Thanks to zan jyu Wong <zyfwong@gmail.com> for bringing this to notice.
For example if CL is only clobbered than CH should not be marked clobbered but CX, RCX and ECX should be mark clobbered. Previously for each modified register all of its aliases are marked clobbered by markRegClobbred() in RegUsageInfoCollector.cpp but that is wrong because when CL is clobbered then MRI::isPhysRegModified() will return true for CL, CX, ECX, RCX which is correct behavior but then for CX, EXC, RCX we mark CH also clobbered as CH is aliased to CX,ECX,RCX so markRegClobbred() is not required because isPhysRegModified already take cares of proper aliasing register. A very simple test case has been added to verify this change.
Please find relevant bug report here : https://llvm.org/bugs/show_bug.cgi?id=28567

Diff Detail

Repository
rL LLVM

Event Timeline

vivekvpandya retitled this revision from to Fix RegMask calculation for alias registers.
vivekvpandya updated this object.
vivekvpandya added subscribers: qcolombet, mcrosier.
vivekvpandya added a subscriber: llvm-commits.
MatzeB accepted this revision.Jul 18 2016, 1:06 PM
MatzeB edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jul 18 2016, 1:06 PM

Should I commit this for you Vivek?

Sorry @MatzeB I don't have commit access. Usually @mehdi_amini commits for me. If you are not able to find time I guess @mehdi_amini will do before this week ends.

no problem, I'll commit it.

This revision was automatically updated to reflect the committed changes.