[llvm-dev] Seeking clarification about indirect critical edges

Stefan Nagy via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 5 15:35:41 PST 2019

Hello all! (I apologize if I've ended up in the wrong list!)

I'm trying to get a better understanding of LLVM's critical edge splitting,
as documented in `Transforms/Utils/BasicBlockUtils.h`; specifically in the
case of critical edges which are indirect transfer.

The code comments discuss the following example: a CFG with direct edges
A->D, B->D, and an indirect critical edge I->D; in this case two identical
"dummy" nodes D0A and D0B would be inserted before D, and the edges would
be re-routed as such: A->D0A, B->D0A, I->D0B, and D0A/D0B would just be
direct jumps to D.

What I'm not understanding is why it is necessary to split the non-critical
edges A->D and B->D? It seems like I->D0B would handle the only edge
causing us trouble in this example; since A and B are direct transfer,
couldn't their jump targets just remain the original D?

Also, the comments hint that this is only possible in some "easy cases".
I'm guessing this means when D has at most one incoming indirect critical

Any explanation would be greatly appreciated!

Stefan Nagy
Department of Computer Science
Virginia Tech
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191105/b9f8645d/attachment.html>

More information about the llvm-dev mailing list