[llvm] r302999 - Fix test failure on windows -- do not return deleted func
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Sat May 13 19:54:03 PDT 2017
Author: davidxl
Date: Sat May 13 21:54:02 2017
New Revision: 302999
URL: http://llvm.org/viewvc/llvm-project?rev=302999&view=rev
Log:
Fix test failure on windows -- do not return deleted func
Modified:
llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp
Modified: llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp?rev=302999&r1=302998&r2=302999&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp Sat May 13 21:54:02 2017
@@ -715,9 +715,15 @@ Function *PartialInlinerImpl::unswitchFu
// 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,
More information about the llvm-commits
mailing list