[PATCH] D63446: Expand cloneLoopWithPreheader() to support cloning loop nest

Whitney via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 13:41:59 PDT 2019


Whitney marked 3 inline comments as done.
Whitney added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/CloneFunction.cpp:777-778
+      assert(OrigParent && "Could not find the original parent loop");
+      Loop *NewParentLoop = LMap[OrigParent];
+      assert(NewParentLoop && "Could not find the new parent loop");
+
----------------
Meinersbur wrote:
> [serious] Since the iteration order of `OrigLoop->getBlocks()` is undefined, we might get a block that is nested in two loops without having visited the parent first, i.e. `NewParentLoop` would be null in this case.
> 
> Consider iterating over `LoopInfo`'s loop tree before iterating over all block to ensure that the new loop structure has been created.
Good catch! Modified as suggested. 


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63446/new/

https://reviews.llvm.org/D63446





More information about the llvm-commits mailing list