OSDN Git Service

[Hexagon] Handle non-immediate operands to A2_addi in getIncrementValue
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Wed, 11 Oct 2017 16:15:31 +0000 (16:15 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Wed, 11 Oct 2017 16:15:31 +0000 (16:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315472 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Hexagon/HexagonInstrInfo.cpp

index 5e2cfbd..f668372 100644 (file)
@@ -1659,10 +1659,12 @@ bool HexagonInstrInfo::getIncrementValue(const MachineInstr &MI,
       Value = OffsetOp.getImm();
       return true;
     }
-  }
-  if (MI.getOpcode() == Hexagon::A2_addi) {
-    Value = MI.getOperand(2).getImm();
-    return true;
+  } else if (MI.getOpcode() == Hexagon::A2_addi) {
+    const MachineOperand &AddOp = MI.getOperand(2);
+    if (AddOp.isImm()) {
+      Value = AddOp.getImm();
+      return true;
+    }
   }
 
   return false;