From d36d036c819f7925b933974fa18eacc95d46049a Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Mon, 20 Jun 2011 14:38:01 +0000 Subject: [PATCH] Change how PHINodes store their operands. Change PHINodes to store simple pointers to their incoming basic blocks, instead of full-blown Uses. Note that this loses an optimization in SplitCriticalEdge(), because we can no longer walk the use list of a BasicBlock to find phi nodes. See the comment I removed starting "However, the foreach loop is slow for blocks with lots of predecessors". Extend replaceAllUsesWith() on a BasicBlock to also update any phi nodes in the block's successors. This mimics what would have happened when PHINodes were proper Users of their incoming blocks. (Note that this only works if OldBB->replaceAllUsesWith(NewBB) is called when OldBB still has a terminator instruction, so it still has some successors.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133435 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGCleanup.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/CGCleanup.cpp b/lib/CodeGen/CGCleanup.cpp index 17a55f09ca..f75253bf78 100644 --- a/lib/CodeGen/CGCleanup.cpp +++ b/lib/CodeGen/CGCleanup.cpp @@ -420,13 +420,13 @@ static llvm::BasicBlock *SimplifyCleanupEntry(CodeGenFunction &CGF, // Kill the branch. Br->eraseFromParent(); - // 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); + // Merge the blocks. + Pred->getInstList().splice(Pred->end(), Entry->getInstList()); + // Kill the entry block. Entry->eraseFromParent(); -- 2.40.0