From e3b557809604d036af6e00c60f012c2025b59a5e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 11 Feb 2023 13:38:04 +0100 Subject: Vendor import of llvm-project main llvmorg-16-init-18548-gb0daacf58f41, the last commit before the upstream release/17.x branch was created. --- llvm/lib/CodeGen/GlobalMerge.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/lib/CodeGen/GlobalMerge.cpp') 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 MustKeepGlobalVariables; + SmallSetVector MustKeepGlobalVariables; public: static char ID; // Pass identification, replacement for typeid. @@ -224,8 +225,8 @@ bool GlobalMerge::doMerge(SmallVectorImpl &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()) { -- cgit v1.3