[PATCH] D84715: [FIX] Add check for empty body function

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 17:26:23 PDT 2020


hoyFB added a comment.

In D84715#2179099 <https://reviews.llvm.org/D84715#2179099>, @weiwang wrote:

> In D84715#2177627 <https://reviews.llvm.org/D84715#2177627>, @wenlei wrote:
>
>> I'm guessing these are not the only passes that will choke with empty/dead functions. If this is because ORE is being used for a special case, then we might want to fix the special case on the user side.
>>
>> If we want passes to absorb such empty functions, then there needs to be consistency for all passes. I don't think passes need to absorb such cases though, as this is really a "limbo state" of functions when being removed (a normal empty function should still have entry block and ret instruction).
>
> Agree. The proposed checks are only placed along the particular call path that leads to the failure. If we are going cover all the analyses/passes, the overall effort could be substantial.
>
> If the big assumption is that there shouldn't be an empty body function to deal with, we can probably change how ORE is created at the beginning. Instead of creating a heavy-weight version of ORE (with all dependent analyses invoked), using the light-weight version `OptimizationRemarkEmitter ORE(F, nullptr)` at LTO.cpp:801 <https://github.com/llvm/llvm-project/blob/master/llvm/lib/LTO/LTO.cpp#L801>.

Can we bail out for dead/empty functions right there before launching ORE on them?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84715



More information about the llvm-commits mailing list