[llvm-commits] [llvm] r43910 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/BreakCriticalMachineEdges.cpp

Chris Lattner clattner at apple.com
Thu Nov 8 14:54:30 PST 2007


On Nov 8, 2007, at 2:20 PM, Owen Anderson wrote:

> Author: resistor
> Date: Thu Nov  8 16:20:23 2007
> New Revision: 43910
>
> URL: http://llvm.org/viewvc/llvm-project?rev=43910&view=rev
> Log:
> Make BreakCriticalMachineEdges available as a pass that can be  
> depended on.

Hey Owen,

Here's a really important case that is non-obvious:

consider:

switch ...
    [1, BB1]
    [2, BB1]
    [3, BB1]
    ...

BB1:
   X = phi [switchblock, x] [switchblock, x] [switchblock, x]  
[otherblock, y]



All three edges between switchblock and BB1 are critical, yet it is  
critially (haha) important that they be split as:

switch ...
    [1, NewBB]
    [2, NewBB]
    [3, NewBB]
    ...

NewBB:
   br BB1

BB1:
   X = phi [BB1, x] [otherblock, y]


Note that in this case, the edges are still critical after the  
xform... fun huh? :)


Also, I second Evan's concern about this being a pass.  It seems like  
it should be a function that passes can call when they need to.  For  
StrongPHI elim for example, it only really needs to split critical  
edges to blocks that have phi's in them, right?

-Chris



More information about the llvm-commits mailing list