summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2017-11-14 11:43:54 +0000
committerTim Northover <tnorthover@apple.com>2017-11-14 11:43:54 +0000
commit5cdc4f9c330c7d4d411e1bbc77084c1415593ded (patch)
tree6271b8501dbad98cded7989efa08065e6bc65bb5 /llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
parent7a91c08414b86eaa8d48d71847d09bde8a075d79 (diff)
downloadbcm5719-llvm-5cdc4f9c330c7d4d411e1bbc77084c1415593ded.tar.gz
bcm5719-llvm-5cdc4f9c330c7d4d411e1bbc77084c1415593ded.zip
ARM: correctly update CFG when splitting BB to fix branch.
Because the block-splitting code is multi-purpose, we have to meddle with the branches when using it to fixup a conditional branch destination. We got the code right, but forgot to update the CFG so the verifier complained when expensive checks were on. Probably harmless since constant-islands comes so late, but best to fix it anyway. llvm-svn: 318148
Diffstat (limited to 'llvm/lib/Target/ARM/ARMConstantIslandPass.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMConstantIslandPass.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
index 79356d70b62..e318a862405 100644
--- a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
+++ b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -1689,6 +1689,12 @@ ARMConstantIslands::fixupConditionalBr(ImmBranch &Br) {
int delta = TII->getInstSizeInBytes(MBB->back());
BBInfo[MBB->getNumber()].Size -= delta;
MBB->back().eraseFromParent();
+
+ // The conditional successor will be swapped between the BBs after this, so
+ // update CFG.
+ MBB->addSuccessor(DestBB);
+ std::next(MBB->getIterator())->removeSuccessor(DestBB);
+
// BBInfo[SplitBB].Offset is wrong temporarily, fixed below
}
MachineBasicBlock *NextBB = &*++MBB->getIterator();
OpenPOWER on IntegriCloud