[PATCH] D80249: CodeGen: Don't lazily construct MachineFunctionInfo

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 16:13:10 PDT 2020


aemerson added a comment.

In D80249#2109204 <https://reviews.llvm.org/D80249#2109204>, @arsenm wrote:

> In D80249#2107516 <https://reviews.llvm.org/D80249#2107516>, @kparzysz wrote:
>
> > A "create" function shouldn't return a null pointer.  I think there should be a default MFI that has nothing in it, and it would be what the `createMachineFunctionInfo` returns a pointer to in the absence of overrides.  It could even be statically allocated since is has no members:
> >
> >   virtual MachineFunctionInfo *
> >   createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,
> >                             const TargetSubtargetInfo *STI) const {
> >     static MachineFunctionInfo default;
> >     return &default;
> >   }
> >
> >
> > Edit: fix indentation in the code
>
>
> Alternatively, make it pure virtual or make it llvm_unreachable?


This is ok with me.


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

https://reviews.llvm.org/D80249





More information about the llvm-commits mailing list