From: Matt Arsenault Date: Thu, 22 Dec 2016 16:06:32 +0000 (+0000) Subject: AMDGPU: Fixed '!NodePtr->isKnownSentinel()' assert X-Git-Tag: android-x86-7.1-r4~22854 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=61ec8435ca738b6634819de01507d9f19a03c771;p=android-x86%2Fexternal-llvm.git AMDGPU: Fixed '!NodePtr->isKnownSentinel()' assert Caused by dereferencing end iterator when trying to const cast the iterator. Patch by Martin Sherburn git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290347 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/AMDGPU/SIMachineScheduler.cpp b/lib/Target/AMDGPU/SIMachineScheduler.cpp index b867aff3705..da86bbf9dd2 100644 --- a/lib/Target/AMDGPU/SIMachineScheduler.cpp +++ b/lib/Target/AMDGPU/SIMachineScheduler.cpp @@ -1114,30 +1114,17 @@ void SIScheduleBlockCreator::createBlocksForVariant(SISchedulerBlockCreatorVaria // Two functions taken from Codegen/MachineScheduler.cpp -/// If this iterator is a debug value, increment until reaching the End or a -/// non-debug instruction. -static MachineBasicBlock::const_iterator -nextIfDebug(MachineBasicBlock::const_iterator I, +/// Non-const version. +static MachineBasicBlock::iterator +nextIfDebug(MachineBasicBlock::iterator I, MachineBasicBlock::const_iterator End) { - for(; I != End; ++I) { + for (; I != End; ++I) { if (!I->isDebugValue()) break; } return I; } -/// Non-const version. -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( - &*nextIfDebug(MachineBasicBlock::const_iterator(I), End))); -} - void SIScheduleBlockCreator::topologicalSort() { unsigned DAGSize = CurrentBlocks.size(); std::vector WorkList;