diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-05-04 00:20:48 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-05-04 00:20:48 +0000 |
commit | 95549497ec8b5269f0439f12859537b7371b7c90 (patch) | |
tree | 4e4fce296da1602e2a45a1bcc457a618eac9fd8f /llvm/lib/Transforms/Utils/SplitModule.cpp | |
parent | c44644d6e9d6ca8020b6ce2435d245766dbb3a00 (diff) | |
download | llvm-95549497ec8b5269f0439f12859537b7371b7c90.zip llvm-95549497ec8b5269f0439f12859537b7371b7c90.tar.gz llvm-95549497ec8b5269f0439f12859537b7371b7c90.tar.bz2 |
[GlobalDCE, Misc] Don't remove functions referenced by ifuncs
We forgot to consider the target of ifuncs when considering if a
function was alive or dead.
N.B. Also update a few auxiliary tools like bugpoint and
verify-uselistorder.
This fixes PR27593.
llvm-svn: 268468
Diffstat (limited to 'llvm/lib/Transforms/Utils/SplitModule.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SplitModule.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/SplitModule.cpp b/llvm/lib/Transforms/Utils/SplitModule.cpp index 6b0ce9c..3db04b8 100644 --- a/llvm/lib/Transforms/Utils/SplitModule.cpp +++ b/llvm/lib/Transforms/Utils/SplitModule.cpp @@ -47,7 +47,7 @@ static void addNonConstUser(ClusterMapType &GVtoClusterMap, if (const Instruction *I = dyn_cast<Instruction>(U)) { const GlobalValue *F = I->getParent()->getParent(); GVtoClusterMap.unionSets(GV, F); - } else if (isa<GlobalAlias>(U) || isa<Function>(U) || + } else if (isa<GlobalIndirectSymbol>(U) || isa<Function>(U) || isa<GlobalVariable>(U)) { GVtoClusterMap.unionSets(GV, cast<GlobalValue>(U)); } else { @@ -107,8 +107,8 @@ static void findPartitions(Module *M, ClusterIDMapType &ClusterIDMap, // For aliases we should not separate them from their aliasees regardless // of linkage. - if (GlobalAlias *GA = dyn_cast<GlobalAlias>(&GV)) { - if (const GlobalObject *Base = GA->getBaseObject()) + if (auto *GIS = dyn_cast<GlobalIndirectSymbol>(&GV)) { + if (const GlobalObject *Base = GIS->getBaseObject()) GVtoClusterMap.unionSets(&GV, Base); } @@ -205,8 +205,8 @@ static void externalize(GlobalValue *GV) { // Returns whether GV should be in partition (0-based) I of N. static bool isInPartition(const GlobalValue *GV, unsigned I, unsigned N) { - if (auto GA = dyn_cast<GlobalAlias>(GV)) - if (const GlobalObject *Base = GA->getBaseObject()) + if (auto *GIS = dyn_cast<GlobalIndirectSymbol>(GV)) + if (const GlobalObject *Base = GIS->getBaseObject()) GV = Base; StringRef Name; @@ -236,6 +236,8 @@ void llvm::SplitModule( externalize(&GV); for (GlobalAlias &GA : M->aliases()) externalize(&GA); + for (GlobalIFunc &GIF : M->ifuncs()) + externalize(&GIF); } // This performs splitting without a need for externalization, which might not |