summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineScheduler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineScheduler.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index 01ef9d834b6..e91fa051f36 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -251,8 +251,8 @@ priorNonDebug(MachineBasicBlock::const_iterator I,
static MachineBasicBlock::iterator
priorNonDebug(MachineBasicBlock::iterator I,
MachineBasicBlock::const_iterator Beg) {
- return const_cast<MachineInstr*>(
- &*priorNonDebug(MachineBasicBlock::const_iterator(I), Beg));
+ return priorNonDebug(MachineBasicBlock::const_iterator(I), Beg)
+ .getNonConstIterator();
}
/// If this iterator is a debug value, increment until reaching the End or a
@@ -271,12 +271,8 @@ nextIfDebug(MachineBasicBlock::const_iterator I,
static MachineBasicBlock::iterator
nextIfDebug(MachineBasicBlock::iterator I,
MachineBasicBlock::const_iterator End) {
- // Cast the return value to nonconst MachineInstr, then cast to an
- // instr_iterator, which does not check for null, finally return a
- // bundle_iterator.
- return MachineBasicBlock::instr_iterator(
- const_cast<MachineInstr*>(
- &*nextIfDebug(MachineBasicBlock::const_iterator(I), End)));
+ return nextIfDebug(MachineBasicBlock::const_iterator(I), End)
+ .getNonConstIterator();
}
/// Instantiate a ScheduleDAGInstrs that will be owned by the caller.
OpenPOWER on IntegriCloud