[PATCH] D149130: [PartialInlining] Fix incorrect costing when IR has unreachable BBs

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 02:18:32 PDT 2023


fhahn added a comment.

In D149130#4297719 <https://reviews.llvm.org/D149130#4297719>, @vedant-amd wrote:

> In D149130#4296535 <https://reviews.llvm.org/D149130#4296535>, @fhahn wrote:
>
>> If the block is unreachable, how come it is even considered for outlining?
>
> I think there's simply no check in place, https://github.com/llvm/llvm-project/blob/8fc1764ef3d18b65b52f82ca4a6bf56ac024e589/llvm/lib/Transforms/IPO/PartialInlining.cpp#L1182
>
> It just checks if the BB can be inlined, if not it marks it for outlining.

Yeah that looks like the right place. Instead of iterating over all blocks in the function, it should probably iterate over all blocks reachable from the entry node (e.g. something like `depth_first(Cloned->getEntryBlock())`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149130



More information about the llvm-commits mailing list