mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
Fix a use after free error caught by the valgrind builders.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110601 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8bd11de33e
commit
3221834f8a
@ -559,7 +559,7 @@ void MergeFunctions::WriteThunk(Function *F, Function *G) const {
|
||||
}
|
||||
|
||||
/// MergeTwoFunctions - Merge two equivalent functions. Upon completion,
|
||||
/// FnVec[j] should never be visited again.
|
||||
/// FnVec[j] is deleted but not removed from the vector.
|
||||
void MergeFunctions::MergeTwoFunctions(std::vector<Function *> &FnVec,
|
||||
unsigned i, unsigned j) const {
|
||||
Function *F = FnVec[i];
|
||||
@ -580,10 +580,12 @@ void MergeFunctions::MergeTwoFunctions(std::vector<Function *> &FnVec,
|
||||
H->takeName(F);
|
||||
F->replaceAllUsesWith(H);
|
||||
|
||||
unsigned MaxAlignment = std::max(G->getAlignment(), H->getAlignment());
|
||||
|
||||
WriteThunk(F, G);
|
||||
WriteThunk(F, H);
|
||||
|
||||
F->setAlignment(std::max(G->getAlignment(), H->getAlignment()));
|
||||
F->setAlignment(MaxAlignment);
|
||||
F->setLinkage(GlobalValue::InternalLinkage);
|
||||
} else {
|
||||
WriteThunk(F, G);
|
||||
|
Loading…
x
Reference in New Issue
Block a user