forked from OSchip/llvm-project
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
This commit is contained in:
parent
654a85e2ee
commit
89e94fc3ad
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue