This is an archive of the discontinued LLVM Phabricator instance.

[CSSPGO] Fix an AV caused by a block that has only pseudo pseudo instructions.
ClosedPublic

Authored by hoy on Apr 27 2021, 5:20 PM.

Diff Detail

Event Timeline

hoy created this revision.Apr 27 2021, 5:20 PM
hoy requested review of this revision.Apr 27 2021, 5:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2021, 5:20 PM

So without this fix, it would AV as well if a block only had dbg instruction?

llvm/lib/CodeGen/RegAllocGreedy.cpp
1328

Without slot index for dbg or probe, we don't know whether the MBB is before the split, is it safe to allow insertion of spill there?

hoy added inline comments.Apr 27 2021, 5:42 PM
llvm/lib/CodeGen/RegAllocGreedy.cpp
1328

I think it's by design. The original code is like below. We were skipping dbg and probe but overlooked that the block could be empty in terms of real instructions.

if (!MBB->empty() &&
      SlotIndex::isEarlierInstr(LIS->getInstructionIndex(MBB->instr_front()),
                                SA->getFirstSplitPoint(Number)))
wenlei accepted this revision.Apr 27 2021, 5:44 PM

lgtm, thanks for the fix.

llvm/lib/CodeGen/RegAllocGreedy.cpp
1328

ok, makes sense. having a probe/dbg is no different from empty block.

This revision is now accepted and ready to land.Apr 27 2021, 5:44 PM
This revision was landed with ongoing or failed builds.Apr 27 2021, 5:54 PM
This revision was automatically updated to reflect the committed changes.