diff options
author | Tim Northover <tnorthover@apple.com> | 2018-12-17 17:25:53 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2018-12-17 17:25:53 +0000 |
commit | 256a16d0314c78b0ee3612e01d0cafbf6c83de7b (patch) | |
tree | ac50144a309aa5c7f1387e827ab9c582c9be4055 /llvm/lib/Target/X86/X86FastISel.cpp | |
parent | 2d6833c9c9e447e5a0a5fa0b0fa9db18b3dd8111 (diff) | |
download | bcm5719-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/Target/X86/X86FastISel.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86FastISel.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp index a49ad8bd59d..cbfdc4b3b93 100644 --- a/llvm/lib/Target/X86/X86FastISel.cpp +++ b/llvm/lib/Target/X86/X86FastISel.cpp @@ -3998,7 +3998,8 @@ bool X86FastISel::tryToFoldLoadIntoMI(MachineInstr *MI, unsigned OpNo, } Result->addMemOperand(*FuncInfo.MF, createMachineMemOperandFor(LI)); - MI->eraseFromParent(); + MachineBasicBlock::iterator I(MI); + removeDeadCode(I, std::next(I)); return true; } |