git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110601
91177308-0d34-0410-b5e6-
96231b3b80d8
}
/// MergeTwoFunctions - Merge two equivalent functions. Upon completion,
}
/// 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];
void MergeFunctions::MergeTwoFunctions(std::vector<Function *> &FnVec,
unsigned i, unsigned j) const {
Function *F = FnVec[i];
H->takeName(F);
F->replaceAllUsesWith(H);
H->takeName(F);
F->replaceAllUsesWith(H);
+ unsigned MaxAlignment = std::max(G->getAlignment(), H->getAlignment());
+
WriteThunk(F, G);
WriteThunk(F, H);
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);
F->setLinkage(GlobalValue::InternalLinkage);
} else {
WriteThunk(F, G);