[llvm-commits] [llvm] r142684 - in /llvm/trunk: lib/Transforms/Utils/CloneFunction.cpp test/Transforms/Inline/blockaddress.ll

Eli Friedman eli.friedman at gmail.com
Fri Oct 21 22:26:00 PDT 2011


On Fri, Oct 21, 2011 at 9:40 PM, Duncan Sands <baldrick at free.fr> wrote:
> Hi Eli,
>
>> +    // It is only legal to clone a function if a block address within that
>> +    // function is never referenced outside of the function.
>
> is this documented anywhere?  The description of CloneFunction doesn't mention
> it.

No docs; might be worth adding.

> Do callers of CloneFunction actually check for this?

The inliner refuses to inline anything containing an indirectbr;
that's equivalent for the important cases.

> Note that it is
> perfectly valid to use a block address in a different function, for example
> storing it in some variable, passing it around - it just isn't legal to branch
> to it from a different function. In short, is this fix really correct?

At the very least, it's an improvement over using an invalid blockaddress.

-Eli




More information about the llvm-commits mailing list