[PATCH] D80249: CodeGen: Don't lazily construct MachineFunctionInfo
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 30 15:14:07 PDT 2020
arsenm added a comment.
Herald added a subscriber: wuzish.
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
I did try to do this, but it didn't work out. It introduces a dependence on CodeGen from Target. I don't think anywhere else uses this pattern to avoid overrides, and just returns null. I don't think this is really an issue in practice, since this is only ever called from target code
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80249/new/
https://reviews.llvm.org/D80249
More information about the llvm-commits
mailing list