[llvm] r252913 - [WinEH] Fix problem with removing an element from a SetVector while iterating.

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 21:21:09 PST 2015


Thanks. It was an issue in;
http://bb.pgr.jp/builders/msbuild-llvmclang-x64-msc18-DA/builds/739

On Fri, Nov 13, 2015 at 2:38 AM Andrew Kaylor via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: akaylor
> Date: Thu Nov 12 11:36:03 2015
> New Revision: 252913
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252913&view=rev
> Log:
> [WinEH] Fix problem with removing an element from a SetVector while
> iterating.
>
> Patch provided by Yaron Keren. (Thanks!)
>
>
> Modified:
>     llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
>
> Modified: llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/WinEHPrepare.cpp?rev=252913&r1=252912&r2=252913&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/WinEHPrepare.cpp (original)
> +++ llvm/trunk/lib/CodeGen/WinEHPrepare.cpp Thu Nov 12 11:36:03 2015
> @@ -1665,18 +1665,12 @@ void WinEHPrepare::cloneCommonBlocks(
>
>          // Remove this block from the FuncletBlocks set of any funclet
> that
>          // isn't the funclet whose color we just selected.
> -        for (auto It = BlockColors[BB].begin(), End =
> BlockColors[BB].end();
> -             It != End; ) {
> -          // The iterator must be incremented here because we are removing
> -          // elements from the set we're walking.
> -          auto Temp = It++;
> -          BasicBlock *ContainingFunclet = *Temp;
> -          if (ContainingFunclet != CorrectColor) {
> +        for (BasicBlock *ContainingFunclet : BlockColors[BB])
> +          if (ContainingFunclet != CorrectColor)
>              FuncletBlocks[ContainingFunclet].erase(BB);
> -            BlockColors[BB].remove(ContainingFunclet);
> -          }
> -        }
> -
> +        BlockColors[BB].remove_if([&](BasicBlock *ContainingFunclet) {
> +          return ContainingFunclet != CorrectColor;
> +        });
>          // This should leave just one color for BB.
>          assert(BlockColors[BB].size() == 1);
>          continue;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151114/c8b8fbb7/attachment.html>


More information about the llvm-commits mailing list