[llvm] r290347 - AMDGPU: Fixed '!NodePtr->isKnownSentinel()' assert
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 22 08:06:32 PST 2016
Author: arsenm
Date: Thu Dec 22 10:06:32 2016
New Revision: 290347
URL: http://llvm.org/viewvc/llvm-project?rev=290347&view=rev
Log:
AMDGPU: Fixed '!NodePtr->isKnownSentinel()' assert
Caused by dereferencing end iterator when trying to const cast the iterator.
Patch by Martin Sherburn
Modified:
llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp?rev=290347&r1=290346&r2=290347&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp Thu Dec 22 10:06:32 2016
@@ -1114,30 +1114,17 @@ void SIScheduleBlockCreator::createBlock
// 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;
More information about the llvm-commits
mailing list