[PATCH] D32353: [LoopSimplify] Simplify constant conditional branches to unconditional branches

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 12:39:43 PDT 2017


efriedma added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopSimplifyCFG.cpp:97
+  // So, we need to update the relevant data structures.
+  // NB: This will never delete any loops completely. It will only delete
+  // blocks within loops.
----------------
efriedma wrote:
> This is pretty clearly false... for example, consider:
> 
>   OldDest:
>     br label %OldDest
> 
> OldDest is no longer a Loop in the LLVM sense because loops only exist in reachable code.
> 
> Or consider the case where OldDest == block; L is not a loop anymore because you deleted the backedge.
Err, the OldDest == block example doesn't precisely work because the other branch would be an exit.  Better example:

  block1:
    br label %block2

  block2:
    bi i1 true, label %block2, label %block1

You're destroying the outer loop by deleting its backedge.


https://reviews.llvm.org/D32353





More information about the llvm-commits mailing list