Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit b4c9d9c

Browse files
committed
Replace some instances of UniqueVector with SetVector, which is slightly cheaper.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167116 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent e03d9e4 commit b4c9d9c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -850,9 +850,9 @@ void DwarfDebug::endModule() {
850850
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("data_end"));
851851

852852
// End text sections.
853-
for (unsigned i = 1, N = SectionMap.size(); i <= N; ++i) {
854-
Asm->OutStreamer.SwitchSection(SectionMap[i]);
855-
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_end", i));
853+
for (unsigned I = 0, E = SectionMap.size(); I != E; ++I) {
854+
Asm->OutStreamer.SwitchSection(SectionMap[I]);
855+
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_end", I+1));
856856
}
857857

858858
// Compute DIE offsets and sizes.

lib/CodeGen/AsmPrinter/DwarfDebug.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#include "llvm/MC/MachineLocation.h"
2222
#include "llvm/ADT/DenseMap.h"
2323
#include "llvm/ADT/FoldingSet.h"
24+
#include "llvm/ADT/SetVector.h"
2425
#include "llvm/ADT/SmallPtrSet.h"
2526
#include "llvm/ADT/StringMap.h"
26-
#include "llvm/ADT/UniqueVector.h"
2727
#include "llvm/Support/Allocator.h"
2828
#include "llvm/Support/DebugLoc.h"
2929

@@ -231,7 +231,7 @@ class DwarfDebug {
231231

232232
/// SectionMap - Provides a unique id per text section.
233233
///
234-
UniqueVector<const MCSection*> SectionMap;
234+
SetVector<const MCSection*> SectionMap;
235235

236236
/// CurrentFnArguments - List of Arguments (DbgValues) for current function.
237237
SmallVector<DbgVariable *, 8> CurrentFnArguments;

lib/Transforms/IPO/FunctionAttrs.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
#include "llvm/Analysis/CallGraph.h"
2929
#include "llvm/Analysis/CaptureTracking.h"
3030
#include "llvm/ADT/SCCIterator.h"
31+
#include "llvm/ADT/SetVector.h"
3132
#include "llvm/ADT/SmallSet.h"
3233
#include "llvm/ADT/Statistic.h"
33-
#include "llvm/ADT/UniqueVector.h"
3434
#include "llvm/Support/InstIterator.h"
3535
using namespace llvm;
3636

@@ -486,13 +486,13 @@ bool FunctionAttrs::AddNoCaptureAttrs(const CallGraphSCC &SCC) {
486486
/// or a pointer that doesn't alias any other pointer visible to the caller.
487487
bool FunctionAttrs::IsFunctionMallocLike(Function *F,
488488
SmallPtrSet<Function*, 8> &SCCNodes) const {
489-
UniqueVector<Value *> FlowsToReturn;
489+
SmallSetVector<Value *, 8> FlowsToReturn;
490490
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I)
491491
if (ReturnInst *Ret = dyn_cast<ReturnInst>(I->getTerminator()))
492492
FlowsToReturn.insert(Ret->getReturnValue());
493493

494494
for (unsigned i = 0; i != FlowsToReturn.size(); ++i) {
495-
Value *RetVal = FlowsToReturn[i+1]; // UniqueVector[0] is reserved.
495+
Value *RetVal = FlowsToReturn[i];
496496

497497
if (Constant *C = dyn_cast<Constant>(RetVal)) {
498498
if (!C->isNullValue() && !isa<UndefValue>(C))

0 commit comments

Comments
 (0)