diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2009-11-22 01:14:08 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2009-11-22 01:14:08 +0000 |
commit | 1722f061a3e7c2f6ef8be9f2f0f7c81ab763c7be (patch) | |
tree | 9f101b816ce6e8cc901c599883112207bea9a271 /lib/Target | |
parent | ef4e604603cf8301e8d30571304578cd2b19b5c3 (diff) | |
download | external_llvm-1722f061a3e7c2f6ef8be9f2f0f7c81ab763c7be.zip external_llvm-1722f061a3e7c2f6ef8be9f2f0f7c81ab763c7be.tar.gz external_llvm-1722f061a3e7c2f6ef8be9f2f0f7c81ab763c7be.tar.bz2 |
Minor optimization: when doing eq/ne comparions and RHS is a constant - swap operands, this will allow us to fold imm into comparison.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89574 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/MSP430/MSP430ISelLowering.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Target/MSP430/MSP430ISelLowering.cpp b/lib/Target/MSP430/MSP430ISelLowering.cpp index adc6d58..29cc370 100644 --- a/lib/Target/MSP430/MSP430ISelLowering.cpp +++ b/lib/Target/MSP430/MSP430ISelLowering.cpp @@ -594,9 +594,17 @@ static SDValue EmitCMP(SDValue &LHS, SDValue &RHS, SDValue &TargetCC, 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 |