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

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 17:44:56 PDT 2021


wenlei accepted this revision.
wenlei added a comment.
This revision is now accepted and ready to land.

lgtm, thanks for the fix.



================
Comment at: llvm/lib/CodeGen/RegAllocGreedy.cpp:1328
+    auto FirstNonDebugInstr = MBB->getFirstNonDebugInstr();
+    if (FirstNonDebugInstr != MBB->end() &&
+        SlotIndex::isEarlierInstr(LIS->getInstructionIndex(*FirstNonDebugInstr),
----------------
hoy wrote:
> wenlei wrote:
> > 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? 
> 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)))
> ```
> 
ok, makes sense. having a probe/dbg is no different from empty block.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101415/new/

https://reviews.llvm.org/D101415



More information about the llvm-commits mailing list