diff options
author | Keno Fischer <kfischer@college.harvard.edu> | 2015-11-16 05:13:30 +0000 |
---|---|---|
committer | Keno Fischer <kfischer@college.harvard.edu> | 2015-11-16 05:13:30 +0000 |
commit | 2ac0c270017fb1c2fa1a894b9e2f96b96dca3423 (patch) | |
tree | 510f1115476d5601cf7c13bcfd9179af3509a3bf /llvm/lib/Transforms | |
parent | 86c95b5642807d2aba091f437d11691b3a285439 (diff) | |
download | bcm5719-llvm-2ac0c270017fb1c2fa1a894b9e2f96b96dca3423.tar.gz bcm5719-llvm-2ac0c270017fb1c2fa1a894b9e2f96b96dca3423.zip |
Also map the personality function in CloneFunctionInto
Summary: The Old personality function gets copied over, but the
Materializer didn't have a chance to inspect it (e.g. to fix up
references to the correct module for the target function).
Also add a verifier check that makes sure the personality routine
is in the same module as the function whose personality it is.
Reviewers: majnemer
Subscribers: jevinskie, llvm-commits
Differential Revision: http://reviews.llvm.org/D14474
llvm-svn: 253183
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Utils/CloneFunction.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index bd6cd3a87b5..72b2c37542a 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -95,6 +95,13 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc, NewFunc->copyAttributesFrom(OldFunc); NewFunc->setAttributes(NewAttrs); + // Fix up the personality function that got copied over. + if (OldFunc->hasPersonalityFn()) + NewFunc->setPersonalityFn( + MapValue(OldFunc->getPersonalityFn(), VMap, + ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges, + TypeMapper, Materializer)); + AttributeSet OldAttrs = OldFunc->getAttributes(); // Clone any argument attributes that are present in the VMap. for (const Argument &OldArg : OldFunc->args()) |