[llvm] r278597 - [X86] Add a check of isCommutable at the top of X86InstrInfo::findCommutedOpIndices. Most callers don't check if the instruction is commutable before calling.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 12 23:48:44 PDT 2016
Author: ctopper
Date: Sat Aug 13 01:48:44 2016
New Revision: 278597
URL: http://llvm.org/viewvc/llvm-project?rev=278597&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=278597&r1=278596&r2=278597&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Sat Aug 13 01:48:44 2016
@@ -3503,6 +3503,9 @@ bool X86InstrInfo::findFMA3CommutedOpInd
bool X86InstrInfo::findCommutedOpIndices(MachineInstr &MI, unsigned &SrcOpIdx1,
unsigned &SrcOpIdx2) const {
+ if (!MI.isCommutable())
+ return false;
+
switch (MI.getOpcode()) {
case X86::CMPPDrri:
case X86::CMPPSrri:
More information about the llvm-commits
mailing list