mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Fix a use after free error caught by the valgrind builders.
llvm-svn: 110601
This commit is contained in:
parent
2d9b975304
commit
920eab5cc1
@ -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…
Reference in New Issue
Block a user