diff options
Diffstat (limited to 'llvm/lib/CodeGen/SelectOptimize.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectOptimize.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectOptimize.cpp b/llvm/lib/CodeGen/SelectOptimize.cpp index 1316919..d14283c 100644 --- a/llvm/lib/CodeGen/SelectOptimize.cpp +++ b/llvm/lib/CodeGen/SelectOptimize.cpp @@ -491,6 +491,23 @@ void SelectOptimizeImpl::convertProfitableSIGroups(SelectGroups &ProfSIGroups) { DI->moveBeforePreserving(&*EndBlock->getFirstInsertionPt()); } + // Duplicate implementation for DPValues, the non-instruction debug-info + // record. Helper lambda for moving DPValues to the end block. + auto TransferDPValues = [&](Instruction &I) { + for (auto &DPValue : llvm::make_early_inc_range(I.getDbgValueRange())) { + DPValue.removeFromParent(); + EndBlock->insertDPValueBefore(&DPValue, + EndBlock->getFirstInsertionPt()); + } + }; + + // Iterate over all instructions in between SI and LastSI, not including + // SI itself. These are all the variable assignments that happen "in the + // middle" of the select group. + auto R = make_range(std::next(SI->getIterator()), + std::next(LastSI->getIterator())); + llvm::for_each(R, TransferDPValues); + // These are the new basic blocks for the conditional branch. // At least one will become an actual new basic block. BasicBlock *TrueBlock = nullptr, *FalseBlock = nullptr; |