llvm.org GIT mirror llvm / 8c3a320
[Internalize] Replace uses of std::set with DenseSet This makes it faster and saves 104 bytes for my build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357458 91177308-0d34-0410-b5e6-96231b3b80d8 Fangrui Song 5 months ago
2 changed file(s) with 6 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
2020 #ifndef LLVM_TRANSFORMS_IPO_INTERNALIZE_H
2121 #define LLVM_TRANSFORMS_IPO_INTERNALIZE_H
2222
23 #include "llvm/ADT/DenseSet.h"
2324 #include "llvm/ADT/StringSet.h"
2425 #include "llvm/IR/GlobalValue.h"
2526 #include "llvm/IR/PassManager.h"
2627 #include
27 #include
2828
2929 namespace llvm {
3030 class Module;
4343 /// Internalize GV if it is possible to do so, i.e. it is not externally
4444 /// visible and is not a member of an externally visible comdat.
4545 bool maybeInternalize(GlobalValue &GV,
46 const std::set &ExternalComdats);
46 const DenseSet &ExternalComdats);
4747 /// If GV is part of a comdat and is externally visible, keep track of its
4848 /// comdat so that we don't internalize any of its members.
4949 void checkComdatVisibility(GlobalValue &GV,
50 std::set &ExternalComdats);
50 DenseSet &ExternalComdats);
5151
5252 public:
5353 InternalizePass();
3131 #include "llvm/Support/raw_ostream.h"
3232 #include "llvm/Transforms/IPO.h"
3333 #include "llvm/Transforms/Utils/GlobalStatus.h"
34 #include
3534 using namespace llvm;
3635
3736 #define DEBUG_TYPE "internalize"
110109 }
111110
112111 bool InternalizePass::maybeInternalize(
113 GlobalValue &GV, const std::set &ExternalComdats) {
112 GlobalValue &GV, const DenseSet &ExternalComdats) {
114113 if (Comdat *C = GV.getComdat()) {
115114 if (ExternalComdats.count(C))
116115 return false;
137136 // If GV is part of a comdat and is externally visible, keep track of its
138137 // comdat so that we don't internalize any of its members.
139138 void InternalizePass::checkComdatVisibility(
140 GlobalValue &GV, std::set &ExternalComdats) {
139 GlobalValue &GV, DenseSet &ExternalComdats) {
141140 Comdat *C = GV.getComdat();
142141 if (!C)
143142 return;
154153 collectUsedGlobalVariables(M, Used, false);
155154
156155 // Collect comdat visiblity information for the module.
157 std::set ExternalComdats;
156 DenseSet ExternalComdats;
158157 if (!M.getComdatSymbolTable().empty()) {
159158 for (Function &F : M)
160159 checkComdatVisibility(F, ExternalComdats);