mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Fix a problem with blocks that need to be split twice.
The code could search past the end of the basic block when there was already a constant pool entry after the block. Test case with giant basic block in SingleSource/UnitTests/Vector/constpool.c llvm-svn: 155753
This commit is contained in:
parent
55623eaf5a
commit
0fe65fee5f
@ -1301,9 +1301,10 @@ void ARMConstantIslands::createNewWater(unsigned CPUserIndex,
|
|||||||
// pool entries following this block; only the last one is in the water list.
|
// pool entries following this block; only the last one is in the water list.
|
||||||
// Back past any possible branches (allow for a conditional and a maximally
|
// Back past any possible branches (allow for a conditional and a maximally
|
||||||
// long unconditional).
|
// long unconditional).
|
||||||
if (BaseInsertOffset >= BBInfo[UserMBB->getNumber()+1].Offset)
|
if (BaseInsertOffset + 8 >= UserBBI.postOffset()) {
|
||||||
BaseInsertOffset = BBInfo[UserMBB->getNumber()+1].Offset -
|
BaseInsertOffset = UserBBI.postOffset() - UPad - 8;
|
||||||
(isThumb1 ? 6 : 8);
|
DEBUG(dbgs() << format("Move inside block: %#x\n", BaseInsertOffset));
|
||||||
|
}
|
||||||
unsigned EndInsertOffset = BaseInsertOffset + 4 + UPad +
|
unsigned EndInsertOffset = BaseInsertOffset + 4 + UPad +
|
||||||
CPEMI->getOperand(2).getImm();
|
CPEMI->getOperand(2).getImm();
|
||||||
MachineBasicBlock::iterator MI = UserMI;
|
MachineBasicBlock::iterator MI = UserMI;
|
||||||
@ -1315,6 +1316,7 @@ void ARMConstantIslands::createNewWater(unsigned CPUserIndex,
|
|||||||
Offset < BaseInsertOffset;
|
Offset < BaseInsertOffset;
|
||||||
Offset += TII->GetInstSizeInBytes(MI),
|
Offset += TII->GetInstSizeInBytes(MI),
|
||||||
MI = llvm::next(MI)) {
|
MI = llvm::next(MI)) {
|
||||||
|
assert(MI != UserMBB->end() && "Fell off end of block");
|
||||||
if (CPUIndex < NumCPUsers && CPUsers[CPUIndex].MI == MI) {
|
if (CPUIndex < NumCPUsers && CPUsers[CPUIndex].MI == MI) {
|
||||||
CPUser &U = CPUsers[CPUIndex];
|
CPUser &U = CPUsers[CPUIndex];
|
||||||
if (!isOffsetInRange(Offset, EndInsertOffset, U)) {
|
if (!isOffsetInRange(Offset, EndInsertOffset, U)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user