[llvm] r357458 - [Internalize] Replace uses of std::set with DenseSet
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 2 02:25:31 PDT 2019
Author: maskray
Date: Tue Apr 2 02:25:31 2019
New Revision: 357458
URL: http://llvm.org/viewvc/llvm-project?rev=357458&view=rev
Log:
[Internalize] Replace uses of std::set with DenseSet
This makes it faster and saves 104 bytes for my build.
Modified:
llvm/trunk/include/llvm/Transforms/IPO/Internalize.h
llvm/trunk/lib/Transforms/IPO/Internalize.cpp
Modified: llvm/trunk/include/llvm/Transforms/IPO/Internalize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/Internalize.h?rev=357458&r1=357457&r2=357458&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/Internalize.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/Internalize.h Tue Apr 2 02:25:31 2019
@@ -21,11 +21,11 @@
#ifndef LLVM_TRANSFORMS_IPO_INTERNALIZE_H
#define LLVM_TRANSFORMS_IPO_INTERNALIZE_H
+#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/PassManager.h"
#include <functional>
-#include <set>
namespace llvm {
class Module;
@@ -44,11 +44,11 @@ class InternalizePass : public PassInfoM
/// Internalize GV if it is possible to do so, i.e. it is not externally
/// visible and is not a member of an externally visible comdat.
bool maybeInternalize(GlobalValue &GV,
- const std::set<const Comdat *> &ExternalComdats);
+ const DenseSet<const Comdat *> &ExternalComdats);
/// If GV is part of a comdat and is externally visible, keep track of its
/// comdat so that we don't internalize any of its members.
void checkComdatVisibility(GlobalValue &GV,
- std::set<const Comdat *> &ExternalComdats);
+ DenseSet<const Comdat *> &ExternalComdats);
public:
InternalizePass();
Modified: llvm/trunk/lib/Transforms/IPO/Internalize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Internalize.cpp?rev=357458&r1=357457&r2=357458&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Internalize.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Internalize.cpp Tue Apr 2 02:25:31 2019
@@ -32,7 +32,6 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Utils/GlobalStatus.h"
-#include <set>
using namespace llvm;
#define DEBUG_TYPE "internalize"
@@ -111,7 +110,7 @@ bool InternalizePass::shouldPreserveGV(c
}
bool InternalizePass::maybeInternalize(
- GlobalValue &GV, const std::set<const Comdat *> &ExternalComdats) {
+ GlobalValue &GV, const DenseSet<const Comdat *> &ExternalComdats) {
if (Comdat *C = GV.getComdat()) {
if (ExternalComdats.count(C))
return false;
@@ -138,7 +137,7 @@ bool InternalizePass::maybeInternalize(
// If GV is part of a comdat and is externally visible, keep track of its
// comdat so that we don't internalize any of its members.
void InternalizePass::checkComdatVisibility(
- GlobalValue &GV, std::set<const Comdat *> &ExternalComdats) {
+ GlobalValue &GV, DenseSet<const Comdat *> &ExternalComdats) {
Comdat *C = GV.getComdat();
if (!C)
return;
@@ -155,7 +154,7 @@ bool InternalizePass::internalizeModule(
collectUsedGlobalVariables(M, Used, false);
// Collect comdat visiblity information for the module.
- std::set<const Comdat *> ExternalComdats;
+ DenseSet<const Comdat *> ExternalComdats;
if (!M.getComdatSymbolTable().empty()) {
for (Function &F : M)
checkComdatVisibility(F, ExternalComdats);
More information about the llvm-commits
mailing list