[X86] Add a check of isCommutable at the top of X86InstrInfo::findCommutedOpIndices...
authorCraig Topper <craig.topper@gmail.com>
Sat, 13 Aug 2016 06:48:44 +0000 (06:48 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 13 Aug 2016 06:48:44 +0000 (06:48 +0000)
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

llvm/lib/Target/X86/X86InstrInfo.cpp

index 9df179d..caa9b85 100644 (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: