[ARM] Fix constant islands pass.

The pass tries to fix a spill of LR that turns out to be unnecessary.
So it removes the tPOP but forgets to remove tPUSH.
This causes the stack be misaligned upon returning the function.

Thus, remove the tPUSH as well in this case.

Differential Revision: https://reviews.llvm.org/D30207

llvm-svn: 295816
This commit is contained in:
Roger Ferrer Ibanez 2017-02-22 09:06:21 +00:00
parent 48e9af6ee8
commit 56db97d4de
2 changed files with 1059 additions and 0 deletions

View File

@ -1741,6 +1741,13 @@ bool ARMConstantIslands::undoLRSpillRestore() {
MI->eraseFromParent();
MadeChange = true;
}
if (MI->getOpcode() == ARM::tPUSH &&
MI->getOperand(2).getReg() == ARM::LR &&
MI->getNumExplicitOperands() == 3) {
// Just remove the push.
MI->eraseFromParent();
MadeChange = true;
}
}
return MadeChange;
}

File diff suppressed because it is too large Load Diff