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

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 13:59:47 PDT 2020


kparzysz added a comment.

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


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

https://reviews.llvm.org/D80249





More information about the llvm-commits mailing list