mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 06:30:16 +00:00
second patch to fix PR992/993.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31610 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0a629fbbca
commit
08ff1480ff
@ -112,8 +112,13 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
|
|||||||
// Calls to external functions are never inlinable.
|
// Calls to external functions are never inlinable.
|
||||||
if (Callee->isExternal() ||
|
if (Callee->isExternal() ||
|
||||||
CallSites[CSi].getInstruction()->getParent()->getParent() ==Callee){
|
CallSites[CSi].getInstruction()->getParent()->getParent() ==Callee){
|
||||||
std::swap(CallSites[CSi], CallSites.back());
|
if (SCC.size() == 1) {
|
||||||
CallSites.pop_back();
|
std::swap(CallSites[CSi], CallSites.back());
|
||||||
|
CallSites.pop_back();
|
||||||
|
} else {
|
||||||
|
// Keep the 'in SCC / not in SCC' boundary correct.
|
||||||
|
CallSites.erase(CallSites.begin()+CSi);
|
||||||
|
}
|
||||||
--CSi;
|
--CSi;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -131,8 +136,16 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
|
|||||||
|
|
||||||
// Attempt to inline the function...
|
// Attempt to inline the function...
|
||||||
if (InlineCallIfPossible(CS, CG, SCCFunctions)) {
|
if (InlineCallIfPossible(CS, CG, SCCFunctions)) {
|
||||||
// Remove this call site from the list.
|
// Remove this call site from the list. If possible, use
|
||||||
CallSites.erase(CallSites.begin()+CSi);
|
// swap/pop_back for efficiency, but do not use it if doing so would
|
||||||
|
// move a call site to a function in this SCC before the
|
||||||
|
// 'FirstCallInSCC' barrier.
|
||||||
|
if (SCC.size() == 1) {
|
||||||
|
std::swap(CallSites[CSi], CallSites.back());
|
||||||
|
CallSites.pop_back();
|
||||||
|
} else {
|
||||||
|
CallSites.erase(CallSites.begin()+CSi);
|
||||||
|
}
|
||||||
--CSi;
|
--CSi;
|
||||||
|
|
||||||
++NumInlined;
|
++NumInlined;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user