summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2015-02-23 16:57:19 +0000
committerBob Wilson <bob.wilson@apple.com>2015-02-23 16:57:19 +0000
commit89e94fc3ad67618b0e95570b9a65c082b2b86a87 (patch)
tree7e68f16d81b76137d5739ae7fbf4aa6bd614b247 /llvm
parent654a85e2ee08367dfbd391440fe5e69d2b3cde4f (diff)
downloadbcm5719-llvm-89e94fc3ad67618b0e95570b9a65c082b2b86a87.tar.gz
bcm5719-llvm-89e94fc3ad67618b0e95570b9a65c082b2b86a87.zip
Fix incorrect immediate size for AddrModeT2_i8s4 in rewriteT2FrameIndex.
The natural way to handle this addressing mode would be to say that it has 8 bits and gets scaled by 4, but since the MC layer is expecting the scaling to be already reflected in the immediate value, we have been setting the Scale to 1. That's fine, but then NumBits needs to be adjusted to reflect the effective increase in the range of the immediate. That adjustment was missing. The consequence is that the register scavenger can fail. The estimateRSStackSizeLimit() function in ARMFrameLowering.cpp correctly assumes that the AddrModeT2_i8s4 address mode can handle scaled offsets up to 1020. Under just the right circumstances, we fail to reserve space for the scavenger because it thinks that nothing will be needed. However, the overly pessimistic behavior in rewriteT2FrameIndex causes some frame indexes to be out of range and require scavenged registers, and so the scavenger asserts. Unfortunately I have not been able to come up with a testcase for this. I can only reproduce it on an internal branch where the frame layout and register allocation is slightly different than trunk. We really need a way to serialize MachineInstr-level IR to write reasonable tests for things like this. rdar://problem/19909005 llvm-svn: 230233
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/ARM/Thumb2InstrInfo.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp b/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
index 91973e1c463..2085bfa9f16 100644
--- a/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
+++ b/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
@@ -574,7 +574,7 @@ bool llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
}
} else if (AddrMode == ARMII::AddrModeT2_i8s4) {
Offset += MI.getOperand(FrameRegIdx + 1).getImm() * 4;
- NumBits = 8;
+ NumBits = 10; // 8 bits scaled by 4
// MCInst operand has already scaled value.
Scale = 1;
if (Offset < 0) {
OpenPOWER on IntegriCloud