diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-12-22 16:06:32 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-12-22 16:06:32 +0000 |
commit | fef7beb6a6901b511c17a16238e7d7e6768f53e4 (patch) | |
tree | 0a02dbc8436c124871f9f55305e34977d460b161 /llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp | |
parent | 7e274e02ae088923e67cd13b99d52644532ad1cc (diff) | |
download | bcm5719-llvm-fef7beb6a6901b511c17a16238e7d7e6768f53e4.tar.gz bcm5719-llvm-fef7beb6a6901b511c17a16238e7d7e6768f53e4.zip |
AMDGPU: Fixed '!NodePtr->isKnownSentinel()' assert
Caused by dereferencing end iterator when trying to const cast the iterator.
Patch by Martin Sherburn
llvm-svn: 290347
Diffstat (limited to 'llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp b/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp index b867aff3705..da86bbf9dd2 100644 --- a/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp +++ b/llvm/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<MachineInstr*>( - &*nextIfDebug(MachineBasicBlock::const_iterator(I), End))); -} - void SIScheduleBlockCreator::topologicalSort() { unsigned DAGSize = CurrentBlocks.size(); std::vector<int> WorkList; |