Handle AddrMode4 for Thumb2 in rewriteT2FrameIndex. This occurs for
authorBob Wilson <bob.wilson@apple.com>
Tue, 15 Sep 2009 17:56:18 +0000 (17:56 +0000)
committerBob Wilson <bob.wilson@apple.com>
Tue, 15 Sep 2009 17:56:18 +0000 (17:56 +0000)
VLDM/VSTM instructions, and without this check, the code assumes that an
offset is allowed, as it would be with VLDR/VSTR.  The asm printer,
however, silently drops the offset, producing incorrect code.  Since the
address register in this case is either the stack or frame pointer, the
spill location ends up conflicting with some other stack slot or with
outgoing arguments on the stack.

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

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;