summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/CloneModule.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-06-30 22:14:01 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-06-30 22:14:01 +0000
commitcda8688f612c4a77a6a6840a391674602d57b729 (patch)
tree9b8291bc60f07bad143645f0771f4ddae04b5447 /llvm/lib/Transforms/Utils/CloneModule.cpp
parente286b0e1f2549da24e1ede64b37e636c4ae152a7 (diff)
downloadbcm5719-llvm-cda8688f612c4a77a6a6840a391674602d57b729.tar.gz
bcm5719-llvm-cda8688f612c4a77a6a6840a391674602d57b729.zip
[Cloning] Teach CloneModule about personality functions
CloneModule didn't take into account that it needed to remap the value using values in the module. This fixes PR23992. llvm-svn: 241122
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneModule.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CloneModule.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneModule.cpp b/llvm/lib/Transforms/Utils/CloneModule.cpp
index 269332206da..61f1811e7b4 100644
--- a/llvm/lib/Transforms/Utils/CloneModule.cpp
+++ b/llvm/lib/Transforms/Utils/CloneModule.cpp
@@ -99,7 +99,11 @@ Module *llvm::CloneModule(const Module *M, ValueToValueMapTy &VMap) {
SmallVector<ReturnInst*, 8> Returns; // Ignore returns cloned.
CloneFunctionInto(F, I, VMap, /*ModuleLevelChanges=*/true, Returns);
+
}
+
+ if (I->hasPersonalityFn())
+ F->setPersonalityFn(MapValue(I->getPersonalityFn(), VMap));
}
// And aliases
OpenPOWER on IntegriCloud