diff options
author | Florian Hahn <florian.hahn@arm.com> | 2017-10-11 20:25:58 +0000 |
---|---|---|
committer | Florian Hahn <florian.hahn@arm.com> | 2017-10-11 20:25:58 +0000 |
commit | e52abba27716d61f8dc762b8dc6de1971d27c965 (patch) | |
tree | 6bebe5c8196bbb54d3afc269aa11b94e00b5f3ff /llvm/lib/CodeGen/MachineCombiner.cpp | |
parent | f22a25e69d9b8ef238b66b65cf29916248a0abe6 (diff) | |
download | bcm5719-llvm-e52abba27716d61f8dc762b8dc6de1971d27c965.tar.gz bcm5719-llvm-e52abba27716d61f8dc762b8dc6de1971d27c965.zip |
[MachineCombiner] Fix initialisation of LastUpdate for incremental update.
Summary:
Fixes a bogus iterator resulting from the removal of a block's first instruction at the point that incremental update is enabled.
Patch by Paul Walker.
Reviewers: fhahn, Gerolf, efriedma, MatzeB
Reviewed By: fhahn
Subscribers: aemerson, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D38734
llvm-svn: 315502
Diffstat (limited to 'llvm/lib/CodeGen/MachineCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineCombiner.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineCombiner.cpp b/llvm/lib/CodeGen/MachineCombiner.cpp index d563370dd4f..3ffef682334 100644 --- a/llvm/lib/CodeGen/MachineCombiner.cpp +++ b/llvm/lib/CodeGen/MachineCombiner.cpp @@ -415,7 +415,7 @@ bool MachineCombiner::combineInstructions(MachineBasicBlock *MBB) { bool IncrementalUpdate = false; auto BlockIter = MBB->begin(); - auto LastUpdate = BlockIter; + decltype(BlockIter) LastUpdate; // Check if the block is in a loop. const MachineLoop *ML = MLI->getLoopFor(MBB); if (!MinInstr) @@ -503,9 +503,11 @@ bool MachineCombiner::combineInstructions(MachineBasicBlock *MBB) { InstrIdxForVirtReg, P, !IncrementalUpdate) && preservesResourceLen(MBB, BlockTrace, InsInstrs, DelInstrs)) { - if (MBB->size() > inc_threshold) + if (MBB->size() > inc_threshold) { // Use incremental depth updates for basic blocks above treshold IncrementalUpdate = true; + LastUpdate = BlockIter; + } insertDeleteInstructions(MBB, MI, InsInstrs, DelInstrs, MinInstr, RegUnits, IncrementalUpdate); |