diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:04 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:11 +0000 |
| commit | e3b557809604d036af6e00c60f012c2025b59a5e (patch) | |
| tree | 8a11ba2269a3b669601e2fd41145b174008f4da8 /llvm/lib/CodeGen/GlobalMerge.cpp | |
| parent | 08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff) | |
Diffstat (limited to 'llvm/lib/CodeGen/GlobalMerge.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/GlobalMerge.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp index f5833d3b9086..2ccf2def48f8 100644 --- a/llvm/lib/CodeGen/GlobalMerge.cpp +++ b/llvm/lib/CodeGen/GlobalMerge.cpp @@ -62,6 +62,7 @@ #include "llvm/ADT/BitVector.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" @@ -181,7 +182,7 @@ namespace { void collectUsedGlobalVariables(Module &M, StringRef Name); /// Keep track of the GlobalVariable that must not be merged away - SmallPtrSet<const GlobalVariable *, 16> MustKeepGlobalVariables; + SmallSetVector<const GlobalVariable *, 16> MustKeepGlobalVariables; public: static char ID; // Pass identification, replacement for typeid. @@ -224,8 +225,8 @@ bool GlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals, llvm::stable_sort( Globals, [&DL](const GlobalVariable *GV1, const GlobalVariable *GV2) { // We don't support scalable global variables. - return DL.getTypeAllocSize(GV1->getValueType()).getFixedSize() < - DL.getTypeAllocSize(GV2->getValueType()).getFixedSize(); + return DL.getTypeAllocSize(GV1->getValueType()).getFixedValue() < + DL.getTypeAllocSize(GV2->getValueType()).getFixedValue(); }); // If we want to just blindly group all globals together, do so. @@ -619,9 +620,8 @@ bool GlobalMerge::doInitialization(Module &M) { LLVM_DEBUG({ dbgs() << "Number of GV that must be kept: " << MustKeepGlobalVariables.size() << "\n"; - for (auto KeptGV = MustKeepGlobalVariables.begin(); - KeptGV != MustKeepGlobalVariables.end(); KeptGV++) - dbgs() << "Kept: " << **KeptGV << "\n"; + for (const GlobalVariable *KeptGV : MustKeepGlobalVariables) + dbgs() << "Kept: " << *KeptGV << "\n"; }); // Grab all non-const globals. for (auto &GV : M.globals()) { |
