summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
diff options
context:
space:
mode:
authorKeno Fischer <kfischer@college.harvard.edu>2015-11-16 05:13:30 +0000
committerKeno Fischer <kfischer@college.harvard.edu>2015-11-16 05:13:30 +0000
commit2ac0c270017fb1c2fa1a894b9e2f96b96dca3423 (patch)
tree510f1115476d5601cf7c13bcfd9179af3509a3bf /llvm/lib/Transforms/Utils
parent86c95b5642807d2aba091f437d11691b3a285439 (diff)
downloadbcm5719-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/Utils')
-rw-r--r--llvm/lib/Transforms/Utils/CloneFunction.cpp7
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())
OpenPOWER on IntegriCloud