[llvm-commits] [llvm] r74396 - in /llvm/trunk: include/llvm/Transforms/Utils/Local.h lib/Transforms/Utils/LoopSimplify.cpp lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/LoopSimplify/merge-exits.ll

Chris Lattner clattner at apple.com
Sat Jun 27 15:36:35 PDT 2009


On Jun 27, 2009, at 2:30 PM, Dan Gohman wrote:

> Author: djg
> Date: Sat Jun 27 16:30:38 2009
> New Revision: 74396
>
> URL: http://llvm.org/viewvc/llvm-project?rev=74396&view=rev
> Log:
> Teach LoopSimplify how to merge multiple loop exits into a single  
> exit,
> when one of them can be converted to a trivial icmp and conditional
> branch.
>
> This addresses what is essentially a phase ordering problem.
> SimplifyCFG knows how to do this transformation, but it doesn't do so
> if the primary block has any instructions in it other than an icmp and
> a branch. In the given testcase, the block contains other  
> instructions,
> however they are loop-invariant and can be hoisted. SimplifyCFG  
> doesn't
> have LoopInfo though, so it can't hoist them. And, it's important that
> the blocks be merged before LoopRotation, as it doesn't support
> multiple-exit loops.

Nice solution!

-Chris



More information about the llvm-commits mailing list