[llvm-commits] [llvm] r53085 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp

Chris Lattner clattner at apple.com
Wed Jul 2 23:00:45 PDT 2008


On Jul 2, 2008, at 10:55 PM, Devang Patel wrote:

> Author: dpatel
> Date: Thu Jul  3 00:55:03 2008
> New Revision: 53085
>
> URL: http://llvm.org/viewvc/llvm-project?rev=53085&view=rev
> Log:
> LoopUnswitch does not preserve dominator info in all cases.

Devang,

In the short term, a horrible but "better than nothing" solution is  
for Unswitch to declare that it preserves domtree info... and have it  
call "recalculate" on the domtree analysis any time it actually  
unswitches a loop in a function.

The advantage of this approach is that recalculation of domtree only  
happens if an unswitch happens.  If you have:

pass_a
loopunswitch
pass_b

and all of them need dominfo, you will get:

dominfo
pass_a
loopunswitch  <sometimes recomputes dominfo from scratch>
pass_b

instead of:

dominfo
pass_a
loopunswitch
dominfo  <always computed>
pass_b

What do you think?

-Chris

>
>
> Modified:
>    llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=53085&r1=53084&r2=53085&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Jul  3  
> 00:55:03 2008
> @@ -112,8 +112,9 @@
>       AU.addPreserved<LoopInfo>();
>       AU.addRequiredID(LCSSAID);
>       AU.addPreservedID(LCSSAID);
> -      AU.addPreserved<DominatorTree>();
> -      AU.addPreserved<DominanceFrontier>();
> +      // FIXME: Loop Unswitch does not preserve dominator info in  
> all cases.
> +      // AU.addPreserved<DominatorTree>();
> +      // AU.addPreserved<DominanceFrontier>();
>     }
>
>   private:
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list