Carlo Alberto Ferraris
2011-Aug-02 16:22 UTC
[LLVMdev] Multiple successors, single dynamic successor
Suppose I have a bb with N predecessors and N successors. What is, in your opinion, the best way to express that the bb has (dynamically) only one successor (i.e. if coming from the i-th predecessor we will always jump to the i-th successor)? b.r., -- Carlo Alberto Ferraris <cafxx at strayorange.com <mailto:cafxx at strayorange.com>> website/blog <http://cafxx.strayorange.com> - +39 333 7643 235 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110802/642dad07/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: cafxx.vcf Type: text/x-vcard Size: 233 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110802/642dad07/attachment.vcf>
Michael Ilseman
2011-Aug-02 18:02 UTC
[LLVMdev] Multiple successors, single dynamic successor
I'm assuming that you're talking about a situation where this can't be determined statically in the existing LLVM IR, but you know it's true and want to put it in (e.g. you're the one generating LLVM IR). If that's not the case, then see if JumpThreading will do it for you. I'm not familiar with a way to express exactly what you want to say, but are you opposed to just duplicating the block? That is, you could duplicate the block, and have the ith predecessor go to the duplicate which goes to the ith successor. You can use JumpThreading::ThreadEdge in lib/Transforms/Scalar/JumpThreading.cpp as a guide. On Tue, Aug 2, 2011 at 10:22 AM, Carlo Alberto Ferraris <cafxx at strayorange.com> wrote:> Suppose I have a bb with N predecessors and N successors. What is, in your > opinion, the best way to express that the bb has (dynamically) only one > successor (i.e. if coming from the i-th predecessor we will always jump to > the i-th successor)? > b.r., > -- > Carlo Alberto Ferraris <cafxx at strayorange.com> > website/blog - +39 333 7643 235 > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
Carlo Alberto Ferraris
2011-Aug-02 20:01 UTC
[LLVMdev] Multiple successors, single dynamic successor
Nella citazione martedì 2 agosto 2011 20:02:08, Michael Ilseman ha scritto:> I'm assuming that you're talking about a situation where this can't be > determined statically in the existing LLVM IR, but you know it's true > and want to put it in (e.g. you're the one generating LLVM IR).Correct. Or, more precisely, I'd like to investigate macro compression, i.e. finding duplicate sequences of instructions and merging them together. Suppose you have two fragments in the cfg like this: a -> b -> c and d -> e -> f. Suppose that basic blocks b and e are identical: macro compression would discard e and have the second fragment transformed like this: d -> b -> f. b has now two predecessor (a and d) and two successors (c and f), but we know that when control comes from a we will always have to jump to c and when coming from d we will always jump to f (basically we could say that macro compression is the inverse of jump threading). My question is: what is the best way to express such relationships in LLVM IR ("best" in the sense of allowing other optimizations to run effectively)? Bear in mind that in this example N=2, but it may be way bigger than that. -- Carlo Alberto Ferraris <cafxx at strayorange.com <mailto:cafxx at strayorange.com>> website/blog <http://cafxx.strayorange.com> - +39 333 7643 235 -------------- next part -------------- A non-text attachment was scrubbed... Name: cafxx.vcf Type: text/x-vcard Size: 233 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110802/ce4698f5/attachment.vcf>
Possibly Parallel Threads
- [LLVMdev] Multiple successors, single dynamic successor
- [LLVMdev] Multiple successors, single dynamic successor
- [LLVMdev] Multiple successors, single dynamic successor
- [LLVMdev] Missed optimization with indirectbr terminator
- [LLVMdev] Missed optimization with indirectbr terminator