aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/CloneFunction.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2023-01-02 09:38:22 -0500
committerMatt Arsenault <arsenm2@gmail.com>2023-01-03 11:07:02 -0500
commite60b0d2a2227a3fa299884bc3388baecdd4c88e6 (patch)
treec2a64a25d65c24836deb0addb43903b9afd1d139 /llvm/lib/Transforms/Utils/CloneFunction.cpp
parent4afb10d572ead76b033c72195f6d280014e04ccc (diff)
downloadllvm-e60b0d2a2227a3fa299884bc3388baecdd4c88e6.zip
llvm-e60b0d2a2227a3fa299884bc3388baecdd4c88e6.tar.gz
llvm-e60b0d2a2227a3fa299884bc3388baecdd4c88e6.tar.bz2
llvm-reduce: Reduce prologue data
Identical to the prefix data handling, and also had broken cloning.
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());