[PATCH] D33839: Prevent outlining of basicblock that uses BlockAddress

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 12:57:43 PDT 2017


On Tue, Jun 27, 2017 at 12:01 PM, Eli Friedman via Phabricator <
reviews at reviews.llvm.org> wrote:

> efriedma added inline comments.
>
>
> ================
> Comment at: lib/Transforms/Utils/CodeExtractor.cpp:79
> +    if (isa<BlockAddress const>(Curr))
> +      return false; // even a reference to self is likely to be not
> compatible
> +
> ----------------
> I'm not sure I follow this check.
>
> You can't extract a basic block whose terminator is an indirectbr; in
> general, you can't efficiently break the relevant CFG edges.  Similarly,
> you can't extract a block with an indirectbr predecessor.  And extracting a
> block whose address is taken is likely to lead to unexpected results in
> other cases for code which abuses block addresses for other uses (like the
> Linux kernel).
>


If  all the indirectbr predecessors and the target block are in the
extracted region, it should be fine to extract the block.  Of course this
patch is more conservative.



>
> But I can't see why you would want to block extracting a basic block just
> because it refers to a blockaddress, or a global variable which contains a
> blockaddress.
>


What you are saying is that the code should directly check the use of
indirectbr instruction instead which sounds better.

David



>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D33839
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170627/c1ad0d71/attachment.html>


More information about the llvm-commits mailing list