[PATCH] D39112: [CodeExtractor] Fix iterator invalidation in findOrCreateBlockForHoisting.

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 31 15:21:30 PDT 2017


ok thanks.

David

On Tue, Oct 31, 2017 at 2:37 PM, Florian Hahn via Phabricator <
reviews at reviews.llvm.org> wrote:

> fhahn added inline comments.
>
>
> ================
> Comment at: lib/Transforms/Utils/CodeExtractor.cpp:312
> +       PI != PE;) {
> +    BasicBlock *Pred = *PI++;
>      if (Blocks.count(Pred))
> ----------------
> davidxl wrote:
> > Move ++ into the for clause?
> I think we have to increment the iterator at the beginning of the loop, as
> replaceUsesOfWith may remove the element PI references and then the
> iterator would become invalid and `Transforms/CodeExtractor/live_shrink_hoist.ll`
> crashes.
>
>
> https://reviews.llvm.org/D39112
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171031/babb61db/attachment.html>


More information about the llvm-commits mailing list