fix PR4984 by ensuring that fastisel adds properly sign extended GEP displacement
[oota-llvm.git] / lib / Target / ARM / Thumb2InstrInfo.cpp
index 8c09ebd3e00b2cb5bdf0fd0683ecdb43cdfc132a..264601bf4143e676f81970f71529c1b280de8bc2 100644 (file)
@@ -383,6 +383,11 @@ bool llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
            "Bit extraction didn't work?");
     MI.getOperand(FrameRegIdx+1).ChangeToImmediate(ThisImmVal);
   } else {
+
+    // AddrMode4 cannot handle any offset.
+    if (AddrMode == ARMII::AddrMode4)
+      return false;
+
     // AddrModeT2_so cannot handle any offset. If there is no offset
     // register then we change to an immediate version.
     unsigned NewOpc = Opcode;