[llvm-commits] [llvm] r89574 - /llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp
Anton Korobeynikov
asl at math.spbu.ru
Sat Nov 21 17:14:09 PST 2009
Author: asl
Date: Sat Nov 21 19:14:08 2009
New Revision: 89574
URL: http://llvm.org/viewvc/llvm-project?rev=89574&view=rev
Log:
Minor optimization: when doing eq/ne comparions and RHS is a constant - swap operands, this will allow us to fold imm into comparison.
Modified:
llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp
Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp?rev=89574&r1=89573&r2=89574&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp Sat Nov 21 19:14:08 2009
@@ -594,9 +594,17 @@
default: llvm_unreachable("Invalid integer condition!");
case ISD::SETEQ:
TCC = MSP430CC::COND_E; // aka COND_Z
+ // Minor optimization: if RHS is a constant, swap operands, then the
+ // constant can be folded into comparison.
+ if (RHS.getOpcode() == ISD::Constant)
+ std::swap(LHS, RHS);
break;
case ISD::SETNE:
TCC = MSP430CC::COND_NE; // aka COND_NZ
+ // Minor optimization: if RHS is a constant, swap operands, then the
+ // constant can be folded into comparison.
+ if (RHS.getOpcode() == ISD::Constant)
+ std::swap(LHS, RHS);
break;
case ISD::SETULE:
std::swap(LHS, RHS); // FALLTHROUGH
More information about the llvm-commits
mailing list