ARMInstrInfo: Improve isSwiftFastImmShift
authorArnold Schwaighofer <aschwaighofer@apple.com>
Tue, 4 Jun 2013 22:15:43 +0000 (22:15 +0000)
committerArnold Schwaighofer <aschwaighofer@apple.com>
Tue, 4 Jun 2013 22:15:43 +0000 (22:15 +0000)
An instruction with less than 3 inputs is trivially a fast immediate shift.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183256 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMBaseInstrInfo.cpp

index 60050542716c23f8766e2f0b9eee54373ae25e80..b530515cdd857e588d94eb92a4cf4950697b88d2 100644 (file)
@@ -4152,6 +4152,8 @@ bool ARMBaseInstrInfo::hasNOP() const {
 }
 
 bool ARMBaseInstrInfo::isSwiftFastImmShift(const MachineInstr *MI) const {
+  if (MI->getNumOperands() < 4)
+    return true;
   unsigned ShOpVal = MI->getOperand(3).getImm();
   unsigned ShImm = ARM_AM::getSORegOffset(ShOpVal);
   // Swift supports faster shifts for: lsl 2, lsl 1, and lsr 1.