[PATCH] D32468: [CodeExtractor]: Fix an extractor bug of missing replacing use of old phi with the new one

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 20:36:02 PDT 2017


davidxl created this revision.

This is triggered by partial inliner improvement patch (so a test case is not yet available) -- but the bug seems obvious. (found with clang built with partial inlining turned on -- it causes infinite loop during indirect call promotion).


https://reviews.llvm.org/D32468

Files:
  lib/Transforms/Utils/CodeExtractor.cpp


Index: lib/Transforms/Utils/CodeExtractor.cpp
===================================================================
--- lib/Transforms/Utils/CodeExtractor.cpp
+++ lib/Transforms/Utils/CodeExtractor.cpp
@@ -220,6 +220,7 @@
       // from OldPred of PN.
       PHINode *NewPN = PHINode::Create(PN->getType(), 1 + NumPredsFromRegion,
                                        PN->getName() + ".ce", &NewBB->front());
+      PN->replaceAllUsesWith(NewPN);
       NewPN->addIncoming(PN, OldPred);
 
       // Loop over all of the incoming value in PN, moving them to NewPN if they


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32468.96496.patch
Type: text/x-patch
Size: 572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170425/7b0f83b2/attachment.bin>


More information about the llvm-commits mailing list