aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/CloneFunction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CloneFunction.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 7e84191..87822ee 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -105,18 +105,25 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
NewFunc->copyAttributesFrom(OldFunc);
NewFunc->setAttributes(NewAttrs);
+ const RemapFlags FuncGlobalRefFlags =
+ ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges;
+
// 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));
+ NewFunc->setPersonalityFn(MapValue(OldFunc->getPersonalityFn(), VMap,
+ FuncGlobalRefFlags, TypeMapper,
+ Materializer));
if (OldFunc->hasPrefixData()) {
- NewFunc->setPrefixData(
- MapValue(OldFunc->getPrefixData(), VMap,
- ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges,
- TypeMapper, Materializer));
+ NewFunc->setPrefixData(MapValue(OldFunc->getPrefixData(), VMap,
+ FuncGlobalRefFlags, TypeMapper,
+ Materializer));
+ }
+
+ if (OldFunc->hasPrologueData()) {
+ NewFunc->setPrologueData(MapValue(OldFunc->getPrologueData(), VMap,
+ FuncGlobalRefFlags, TypeMapper,
+ Materializer));
}
SmallVector<AttributeSet, 4> NewArgAttrs(NewFunc->arg_size());