[PATCH] D40113: AMDGPU: Fix crash when scheduling DBG_VALUE

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 17 16:52:47 PST 2017


rampitec added inline comments.


================
Comment at: lib/Target/AMDGPU/GCNSchedStrategy.cpp:333
   Unsched.reserve(NumRegionInstrs);
-  for (auto &I : *this)
-    Unsched.push_back(&I);
+  for (auto &I : *this) {
+    if (!I.isDebugValue())
----------------
arsenm wrote:
> rampitec wrote:
> > arsenm wrote:
> > > rampitec wrote:
> > > > I am afraid this will push RegionBegin iterator. Maybe you need to skip a debug value in the loop at line 389 instead.
> > > That's what I did originally, but then it seems to just be adding unneeded instructions to the vector.  The loop over this uses MI->getIterator(), so I don't think there's a difference
> > Check statement "RegionBegin = Unsched.front()->getIterator();" below at line 415.
> I think the only thing that will change is if a dbg_value is considered the start of the region. I'm not sure how exactly dbg_value is supposed to interact with the region. Looking at the generic code it seems like dbg_value isn't considered part of a scheduling region, and is skipped over so maybe this shouldn't be allowing dbg_value as the RegionBegin?
It probably should not even come to the scheduling, but since it is here we shall preserve region iterators, otherwise weird errors occur.


https://reviews.llvm.org/D40113





More information about the llvm-commits mailing list