This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Correct missue of getOperandConstraint in PPCInstrInfo::commuteInstructionImpl
ClosedPublic

Authored by craig.topper on Jun 12 2023, 3:05 PM.

Details

Summary

getOperandConstraint does not return a bool, it returns an int. It
returns -1 if there is no TIED_TO.

Additionally, TIED_TO is only set on use operands not defs and it
points to the def that the use is tied to. So calling it on operand 0
is guaranteed to return -1.

As far as I can tell this code must have been copied from the
generic implementation prior to 6aa2744bed0b8.o

Unfortunately, this code is not executed in lit tests. I just happened
to notice it while looking for other uses of TIED_TO for something
I was working on.

Diff Detail

Event Timeline

craig.topper created this revision.Jun 12 2023, 3:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 12 2023, 3:05 PM
craig.topper requested review of this revision.Jun 12 2023, 3:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 12 2023, 3:05 PM
nemanjai accepted this revision.Aug 8 2023, 7:31 AM

Sorry I missed this. LGTM.

llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
1176–1177

Maybe clarify here with a comment such as:

// Must be two address instruction (i.e. op1 is tied to op0).
This revision is now accepted and ready to land.Aug 8 2023, 7:31 AM