aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineScheduler.cpp
diff options
context:
space:
mode:
authorVang Thao <Vang.Thao@amd.com>2022-02-04 10:44:20 -0800
committerVang Thao <Vang.Thao@amd.com>2022-02-07 11:01:13 -0800
commit570471199bfa18fa0ee153336bd84e47dc5480a6 (patch)
tree2a8cf82e5a7ae7b9cd5eb6ecb6098f9a3b4fa2d0 /llvm/lib/CodeGen/MachineScheduler.cpp
parent5c2ae5f45452a67503858bf33319606fe2864ad8 (diff)
downloadllvm-570471199bfa18fa0ee153336bd84e47dc5480a6.zip
llvm-570471199bfa18fa0ee153336bd84e47dc5480a6.tar.gz
llvm-570471199bfa18fa0ee153336bd84e47dc5480a6.tar.bz2
[AMDGPU] Fix debug values in scheduler not placed correctly when reverting
Debug position data is cleared after ScheduleDAGMILive::schedule() due to it also calling placeDebugValues(). Make it so the data is not cleared after initial call to placeDebugValues since we will call it again after reverting a schedule. Secondly, since we skip debug instructions when reverting the schedule on AMDGPU, all debug instructions are now moved to the end of the scheduling region. RegionEnd points to the beginning of this chunk of debug instructions since it was not incremented when a debug instruction was skipped. RegionBegin may also point to the same debug instruction if Unsched.front() is a debug instruction thus shrinking the region to 1. Fix RegionBegin and RegionEnd so that they point to the current beginning and ending before calling placeDebugValues() since both vars will be used as reference points to move debug instructions back. Reviewed By: rampitec Differential Revision: https://reviews.llvm.org/D119022
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineScheduler.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index b043d4c..902c397 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -920,12 +920,10 @@ void ScheduleDAGMI::placeDebugValues() {
MachineBasicBlock::iterator OrigPrevMI = P.second;
if (&*RegionBegin == DbgValue)
++RegionBegin;
- BB->splice(++OrigPrevMI, BB, DbgValue);
- if (OrigPrevMI == std::prev(RegionEnd))
+ BB->splice(std::next(OrigPrevMI), BB, DbgValue);
+ if (RegionEnd != BB->end() && OrigPrevMI == &*RegionEnd)
RegionEnd = DbgValue;
}
- DbgValues.clear();
- FirstDbgValue = nullptr;
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)