[X86] Add a check of isCommutable at the top of X86InstrInfo::findCommutedOpIndices. Most callers don't check if the instruction is commutable before calling.

This saves us the trouble of ending up in the default of the switch and having to determine if this is an FMA or not.

llvm-svn: 278597
This commit is contained in:
Craig Topper 2016-08-13 06:48:44 +00:00
parent eafdbecc44
commit 8c372a31b7
1 changed files with 3 additions and 0 deletions

View File

@ -3503,6 +3503,9 @@ bool X86InstrInfo::findFMA3CommutedOpIndices(
bool X86InstrInfo::findCommutedOpIndices(MachineInstr &MI, unsigned &SrcOpIdx1,
unsigned &SrcOpIdx2) const {
if (!MI.isCommutable())
return false;
switch (MI.getOpcode()) {
case X86::CMPPDrri:
case X86::CMPPSrri: