[llvm-commits] [llvm] r168829 - /llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
Rafael EspĂndola
rafael.espindola at gmail.com
Thu Nov 29 08:53:13 PST 2012
testcase?
On 28 November 2012 18:23, Bill Wendling <isanbard at gmail.com> wrote:
> Author: void
> Date: Wed Nov 28 17:23:48 2012
> New Revision: 168829
>
> URL: http://llvm.org/viewvc/llvm-project?rev=168829&view=rev
> Log:
> When we delete a dead basic block, see if any of its successors are dead and
> delete those as well.
>
> Modified:
> llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=168829&r1=168828&r2=168829&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Wed Nov 28 17:23:48 2012
> @@ -194,9 +194,19 @@
> WorkList.insert(*II);
> }
>
> - for (SmallPtrSet<BasicBlock*, 8>::iterator
> - I = WorkList.begin(), E = WorkList.end(); I != E; ++I)
> - DeleteDeadBlock(*I);
> + // Delete the dead blocks and any of their dead successors.
> + while (!WorkList.empty()) {
> + BasicBlock *BB = *WorkList.begin();
> + WorkList.erase(BB);
> + SmallVector<BasicBlock*, 2> Successors(succ_begin(BB), succ_end(BB));
> +
> + DeleteDeadBlock(BB);
> +
> + for (SmallVectorImpl<BasicBlock*>::iterator
> + II = Successors.begin(), IE = Successors.end(); II != IE; ++II)
> + if (pred_begin(*II) == pred_end(*II))
> + WorkList.insert(*II);
> + }
>
> // Merge pairs of basic blocks with unconditional branches, connected by
> // a single edge.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list