[PATCH] D101525: RegAlloc: do not consider liveins to EH-pad successors as liveout.

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 11 07:05:15 PDT 2021


t.p.northover added inline comments.


================
Comment at: llvm/lib/CodeGen/RegAllocFast.cpp:1455
+           LI.PhysReg == TLI->getExceptionSelectorRegister(PersonalityFn)))
+        continue;
       setPhysRegState(LI.PhysReg, regPreAssigned);
----------------
efriedma wrote:
> t.p.northover wrote:
> > efriedma wrote:
> > > Calling getExceptionPointerRegister() directly from fast regalloc seems hacky.  We don't want to copy-paste this code everywhere that cares about physical register live-outs.
> > I could add a `MachineBasicBlock::liveouts` that does the iteration. Simplest would probably be to return a `SmallSet` because of the potential issue with duplicates, but that doesn't quite fit with the liveins iterator-based interface. Otherwise it's probably an iterator adapter containing that `SmallSet`.
> Probably most places that would use this can handle duplicates, so it would be fine to just implement an iterator over the raw list including duplicates.
> 
> I spent a bit of time trying to come up with some way to represent this that's a bit cleaner, but I didn't really have any good ideas.  Maybe we could partition the "liveins" list in MachineBasicBlock to distinguish between registers that are live-out from a predecessor, and ones that are set by the unwinder?  The advantages would just be that we don't have to query TLI, and MIR dumps would be a bit easier to understand.
> Probably most places that would use this can handle duplicates, so it would be fine to just implement an iterator over the raw list including duplicates.

I suppose so, there may well be subregisters or overlapping ones floating about in the list anyway.

> Maybe we could partition the "liveins" list in MachineBasicBlock to distinguish between registers that are live-out from a predecessor, and ones that are set by the unwinder?

I can't really think of a place that would be a useful distinction except when backcalculating liveouts as here, so I'm still inclined to keep the logic here.


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

https://reviews.llvm.org/D101525



More information about the llvm-commits mailing list