CodeExtractor sort of does this. First, it's a utility, not a pass - you'd still need to wrap it up with pass that actually causes it to outlines what you want it to outline. Second, it's a bit buggy. There are, as far as I know, two in-tree users of this utility: bugpoint, and partial inlining. Both of them are fairly specialized use-cases, and don't actually exercise the full generality of outlining an arbitrary region. And since a lot of cases are in practice untested - they don't quite work. I've had some fixes for this internally, but never actually upstreamed them, and no longer have access to that codebase. So, you'll probably run into the same issues if you try to do anything untrivial with it. Michael On 12 April 2016 at 13:24, Tom Chen via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Does this do what you want > http://llvm.org/docs/doxygen/html/classllvm_1_1CodeExtractor.html? > > 2016-04-12 14:58 GMT-05:00 Minghwa Wang via llvm-dev < > llvm-dev at lists.llvm.org>: > >> Is there any support for outlining in llvm? >> >> As we know outlining is the opposite of inlining and while refactoring, >> if we can outlining common code into functions, then function merge >> (supported by llvm) can be more efficient in reducing code size. >> >> If llvm support outlining, how to use it? Any documentation for it? >> >> Thanks, >> Ming-Hwa >> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160412/5cf11ed8/attachment.html>
Thank you Michael and Tom for the quick reply. According to your experience and comments, CodeExtractor is buggy only works for special cases but not general enough for most usages. Then do we have other outlining solution in llvm? Or I have to repeat what Michel done before? Best regards, Ming-Hwa On Tue, Apr 12, 2016 at 1:48 PM, Michael Kuperstein < michael.kuperstein at gmail.com> wrote:> CodeExtractor sort of does this. > > First, it's a utility, not a pass - you'd still need to wrap it up with > pass that actually causes it to outlines what you want it to outline. > > Second, it's a bit buggy. There are, as far as I know, two in-tree users > of this utility: bugpoint, and partial inlining. Both of them are fairly > specialized use-cases, and don't actually exercise the full generality of > outlining an arbitrary region. And since a lot of cases are in practice > untested - they don't quite work. > I've had some fixes for this internally, but never actually upstreamed > them, and no longer have access to that codebase. So, you'll probably run > into the same issues if you try to do anything untrivial with it. > > Michael > > > > On 12 April 2016 at 13:24, Tom Chen via llvm-dev <llvm-dev at lists.llvm.org> > wrote: > >> Does this do what you want >> http://llvm.org/docs/doxygen/html/classllvm_1_1CodeExtractor.html? >> >> 2016-04-12 14:58 GMT-05:00 Minghwa Wang via llvm-dev < >> llvm-dev at lists.llvm.org>: >> >>> Is there any support for outlining in llvm? >>> >>> As we know outlining is the opposite of inlining and while refactoring, >>> if we can outlining common code into functions, then function merge >>> (supported by llvm) can be more efficient in reducing code size. >>> >>> If llvm support outlining, how to use it? Any documentation for it? >>> >>> Thanks, >>> Ming-Hwa >>> >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> llvm-dev at lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>> >>> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160412/e7b225ba/attachment.html>
I'm not aware of anything else in LLVM that performs outlining. Ayal (CCed) may be able to help you regarding CodeExtractor fixes. Thanks, Michael On 12 April 2016 at 14:21, Minghwa Wang <mwang2 at cse.scu.edu> wrote:> Thank you Michael and Tom for the quick reply. > > According to your experience and comments, CodeExtractor is buggy only > works for special cases but not general enough for most usages. Then do we > have other outlining solution in llvm? Or I have to repeat what Michel done > before? > > Best regards, > Ming-Hwa > > On Tue, Apr 12, 2016 at 1:48 PM, Michael Kuperstein < > michael.kuperstein at gmail.com> wrote: > >> CodeExtractor sort of does this. >> >> First, it's a utility, not a pass - you'd still need to wrap it up with >> pass that actually causes it to outlines what you want it to outline. >> >> Second, it's a bit buggy. There are, as far as I know, two in-tree users >> of this utility: bugpoint, and partial inlining. Both of them are fairly >> specialized use-cases, and don't actually exercise the full generality of >> outlining an arbitrary region. And since a lot of cases are in practice >> untested - they don't quite work. >> I've had some fixes for this internally, but never actually upstreamed >> them, and no longer have access to that codebase. So, you'll probably run >> into the same issues if you try to do anything untrivial with it. >> >> Michael >> >> >> >> On 12 April 2016 at 13:24, Tom Chen via llvm-dev <llvm-dev at lists.llvm.org >> > wrote: >> >>> Does this do what you want >>> http://llvm.org/docs/doxygen/html/classllvm_1_1CodeExtractor.html? >>> >>> 2016-04-12 14:58 GMT-05:00 Minghwa Wang via llvm-dev < >>> llvm-dev at lists.llvm.org>: >>> >>>> Is there any support for outlining in llvm? >>>> >>>> As we know outlining is the opposite of inlining and while refactoring, >>>> if we can outlining common code into functions, then function merge >>>> (supported by llvm) can be more efficient in reducing code size. >>>> >>>> If llvm support outlining, how to use it? Any documentation for it? >>>> >>>> Thanks, >>>> Ming-Hwa >>>> >>>> >>>> _______________________________________________ >>>> LLVM Developers mailing list >>>> llvm-dev at lists.llvm.org >>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>>> >>>> >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> llvm-dev at lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>> >>> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160412/8ed6edf4/attachment.html>