From b8424370ff7ebb63db04b2398ddaa92e829582a4 Mon Sep 17 00:00:00 2001 From: John McCall Date: Fri, 14 Jan 2011 10:35:38 +0000 Subject: 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123438 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/CodeGen/CodeGenFunction.cpp') diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 281a62f899..76698464c2 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/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(); -- cgit v1.2.3-18-g5258