summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2018-12-17 17:25:53 +0000
committerTim Northover <tnorthover@apple.com>2018-12-17 17:25:53 +0000
commit256a16d0314c78b0ee3612e01d0cafbf6c83de7b (patch)
treeac50144a309aa5c7f1387e827ab9c582c9be4055 /llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
parent2d6833c9c9e447e5a0a5fa0b0fa9db18b3dd8111 (diff)
downloadbcm5719-llvm-256a16d0314c78b0ee3612e01d0cafbf6c83de7b.tar.gz
bcm5719-llvm-256a16d0314c78b0ee3612e01d0cafbf6c83de7b.zip
FastIsel: take care to update iterators when removing instructions.
We keep a few iterators into the basic block we're selecting while performing FastISel. Usually this is fine, but occasionally code wants to remove already-emitted instructions. When this happens we have to be careful to update those iterators so they're not pointint at dangling memory. llvm-svn: 349365
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index d5f066c2423..a9a3c44ea0c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -547,6 +547,15 @@ void FastISel::removeDeadCode(MachineBasicBlock::iterator I,
assert(I.isValid() && E.isValid() && std::distance(I, E) > 0 &&
"Invalid iterator!");
while (I != E) {
+ if (LastFlushPoint == I)
+ LastFlushPoint = E;
+ if (SavedInsertPt == I)
+ SavedInsertPt = E;
+ if (EmitStartPt == I)
+ EmitStartPt = E.isValid() ? &*E : nullptr;
+ if (LastLocalValue == I)
+ LastLocalValue = E.isValid() ? &*E : nullptr;
+
MachineInstr *Dead = &*I;
++I;
Dead->eraseFromParent();
OpenPOWER on IntegriCloud