This is an archive of the discontinued LLVM Phabricator instance.

Fix the addition of implicit register operands in incorrect order in SiInstrInfo.
ClosedPublic

Authored by arphaman on Jul 31 2015, 12:07 PM.

Details

Summary

This patch fixes a bug in SIInstrInfo where the implicit register operands were added to a machine instruction
in incorrect order - The implicit uses were added before the implicit defs.
I found this bug while trying to enable the implicit register operand verification in machine verifier.

Before:

V_ADD_I32_e32 killed %13, killed %12, implicit %exec, implicit-def %vcc

After:

V_ADD_I32_e32 killed %13, killed %12, implicit-def %vcc, implicit %exec

This patch also makes the method 'addImplicitDefUseOperands' in the machine instruction class public so that we can reuse it in SIInstrInfo.

Diff Detail

Repository
rL LLVM

Event Timeline

arphaman updated this revision to Diff 31152.Jul 31 2015, 12:07 PM
arphaman retitled this revision from to Fix the addition of implicit register operands in incorrect order in SiInstrInfo..
arphaman updated this object.
arphaman set the repository for this revision to rL LLVM.
arphaman added a subscriber: llvm-commits.
arsenm added inline comments.Jul 31 2015, 12:14 PM
lib/Target/AMDGPU/SIInstrInfo.cpp
2600 ↗(On Diff #31152)

I didn't know about this function. I think it's OK to delete addDescImplicitUseDef and just use Inst->addImplicitDefUseOperands in the one place it is used

arphaman updated this revision to Diff 31176.Jul 31 2015, 3:40 PM

I deleted the method 'SIInstrInfo::addDescImplicitUseDef' and used the method 'addImplicitDefUseOperands' from the machine instruction class directly.

arsenm accepted this revision.Jul 31 2015, 3:45 PM
arsenm edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jul 31 2015, 3:45 PM
This revision was automatically updated to reflect the committed changes.
arphaman marked an inline comment as done.