[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:07:36 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.
----------------
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.


================
Comment at: lib/Transforms/Scalar/LoopSimplifyCFG.cpp:157
+  // blocks are marked as dominated by the entry block.  TODO: Fix the dominator
+  // tree in place.
+  if (ChangedConstantFolding)
----------------
You're messing up updating dominfo in many ways besides this.


https://reviews.llvm.org/D32353





More information about the llvm-commits mailing list