From 5461a7523f4d92f9fa8ebfc95a708ac64a8a97fc Mon Sep 17 00:00:00 2001 From: John McCall Date: Fri, 14 Jan 2011 10:35:38 +0000 Subject: [PATCH] When simplifying a cleanup's entry by merging it into a single predecessor, replace all uses of the entry with the predecessor. There are no cleanups relying on this right now, but if we ever want a cleanup with a phi inside it, this will be important. llvm-svn: 123438 --- clang/lib/CodeGen/CodeGenFunction.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 281a62f899a2..76698464c24b 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -754,6 +754,10 @@ static llvm::BasicBlock *SimplifyCleanupEntry(CodeGenFunction &CGF, // Merge the blocks. Pred->getInstList().splice(Pred->end(), Entry->getInstList()); + // Replace all uses of the entry with the predecessor, in case there + // are phis in the cleanup. + Entry->replaceAllUsesWith(Pred); + // Kill the entry block. Entry->eraseFromParent();