[LLVMdev] Cloned Functions Are Not the Same
John Criswell
jtcriswel at gmail.com
Tue Dec 2 07:28:02 PST 2014
On 12/1/14, 11:15 PM, Rahman Lavaee wrote:
> I am trying to use CloneFunction to clone every IR function in a
> program, give the cloned versions a prefix and call the clones from
> the original functions (redirect the calls).
>
> Surprisingly, I see that after the LTO optimizations, the number of
> machine basic blocks in the two functions differ in some cases.
>
> Is this reasonable at all, given that the two functions must be
> exactly the same in the IR level.
>
> Or it might happen because of the interprocedural optimizations?
Have you verified that the old and new functions are identical at the
LLVM IR level right before code generation in libLTO (you can easily
modify libLTO to dump out the LLVM IR right before code generation). It
might happen because of inter-procedural optimizations. If the old
functions are no longer called, then inter-procedural constant
propagation and other inter-procedural optimizations may change the new
functions but not the old functions.
I don't know if the code generators do any inter-procedural analysis; my
impression was that they did not. However, someone else needs to answer
that question.
Regards,
John Criswell
>
> --
> Rahman
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141202/51cd6de4/attachment.html>
More information about the llvm-dev
mailing list