]> granicus.if.org Git - llvm/commitdiff
Fix test failure on windows -- do not return deleted func
authorXinliang David Li <davidxl@google.com>
Sun, 14 May 2017 02:54:02 +0000 (02:54 +0000)
committerXinliang David Li <davidxl@google.com>
Sun, 14 May 2017 02:54:02 +0000 (02:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302999 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/PartialInlining.cpp

index 5550376279f28b3e5dba440a1af25159c39841c6..739b0dae3146c3e6c3d4bbcb255a0fb71e821bc4 100644 (file)
@@ -715,9 +715,15 @@ Function *PartialInlinerImpl::unswitchFunction(Function *F) {
   // users (function pointers, etc.) back to the original function.
   DuplicateFunction->replaceAllUsesWith(F);
   DuplicateFunction->eraseFromParent();
-  if (!AnyInline && OutlinedFunction)
+
+  if (AnyInline)
+    return OutlinedFunction;
+
+  // Remove the function that is speculatively created:
+  if (OutlinedFunction)
     OutlinedFunction->eraseFromParent();
-  return OutlinedFunction;
+
+  return nullptr;
 }
 
 bool PartialInlinerImpl::tryPartialInline(Function *DuplicateFunction,