[llvm] r213474 - [C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges.

NAKAMURA Takumi geek4civic at gmail.com
Mon Jul 21 13:43:10 PDT 2014


>> @@ -2885,8 +2884,8 @@ bool SimplifyCFGOpt::SimplifyResume(Resu
>>   // Turn all invokes that unwind here into calls and delete the basic block.
>>   bool InvokeRequiresTableEntry = false;
>>   bool Changed = false;
>> -  for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE;) {
>> -    InvokeInst *II = cast<InvokeInst>((*PI++)->getTerminator());
>> +  for (BasicBlock *Pred : predecessors(BB)) {
>> +    InvokeInst *II = cast<InvokeInst>(Pred->getTerminator());
>
> This is a bug.  `II` gets deleted below.  `PI` needs to be incremented
> *now*, not at the end of the block.

Yes, it caused memory leak. Just to revert it, the builder became green.
FYI, see also,
http://bb.pgr.jp/builders/msbuild-llvmclang-x64-msc17-DA/builds/849
I found it also with valgrind.



More information about the llvm-commits mailing list