[PATCH][TargetInstrInfo] Fix the implementation of commuteInstruction to match the comment of the API
qcolombet at apple.com
Thu May 8 16:19:43 PDT 2014
This is r208371.
On May 8, 2014, at 4:13 PM, Tom Stellard <tom at stellard.net> wrote:
> On Thu, May 08, 2014 at 04:04:13PM -0700, Quentin Colombet wrote:
>> The proposed patch relaxes the behavior of TargetInstrInfo::commuteInstruction when TargetInstrInfo::findCommutedOpIndices returns false.
>> Currently TargetInstrInfo triggers a fatal error in such situation whereas based on the comment in the API it should just return nullptr. Indeed the only precondition that should be ensured is that the instruction must be commutable.
>> Spotted via code inspection.
>> Is it okay to commit?
>> /// commuteInstruction - If a target has any instructions that are
>> /// commutable but require converting to different instructions or making
>> /// non-trivial changes to commute them, this method can overloaded to do
>> /// that. The default implementation simply swaps the commutable operands.
>> /// If NewMI is false, MI is modified in place and returned; otherwise, a
>> /// new machine instruction is created and returned. Do not call this
>> /// method for a non-commutable instruction, but there may be some cases
>> /// where this method fails and returns null.
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits