Skip to content

Commit

Permalink
Merged main:9a7fb0848771 into amd-gfx:ef899f5bb13a
Browse files Browse the repository at this point in the history
Local branch amd-gfx ef899f5 Merged main:7e9e6ac526eb into amd-gfx:58646d400256
Remote branch main 9a7fb08 NFC: Minor cleanup of function calls
  • Loading branch information
Sw authored and Sw committed Jan 17, 2021
2 parents ef899f5 + 9a7fb08 commit bee6f06
Show file tree
Hide file tree
Showing 25 changed files with 77 additions and 94 deletions.
5 changes: 1 addition & 4 deletions clang/lib/ASTMatchers/ASTMatchFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,7 @@ class MatchChildASTVisitor
return true;
ScopedIncrement ScopedDepth(&CurrentDepth);

if (!match(*Node->getDecomposedForm().LHS) ||
!match(*Node->getDecomposedForm().RHS))
return false;
return true;
return match(*Node->getLHS()) && match(*Node->getRHS());
}
bool TraverseLambdaExpr(LambdaExpr *Node) {
if (!Finder->isTraversalIgnoringImplicitNodes())
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Config/llvm-config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

/* Indicate that this is LLVM compiled from the amd-gfx branch. */
#define LLVM_HAVE_BRANCH_AMD_GFX
#define LLVM_MAIN_REVISION 377243
#define LLVM_MAIN_REVISION 377247

/* Define if LLVM_ENABLE_DUMP is enabled */
#cmakedefine LLVM_ENABLE_DUMP
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3830,7 +3830,7 @@ void ModuleBitcodeWriterBase::writeModuleLevelReferences(
NameVals.push_back(VE.getValueID(RI.getValue()));
// Sort the refs for determinism output, the vector returned by FS->refs() has
// been initialized from a DenseSet.
llvm::sort(NameVals.begin() + SizeBeforeRefs, NameVals.end());
llvm::sort(drop_begin(NameVals, SizeBeforeRefs));

if (VTableFuncs.empty())
Stream.EmitRecord(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS, NameVals,
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/DWARFLinker/DWARFLinker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2590,7 +2590,7 @@ bool DWARFLinker::link() {
std::vector<std::pair<StringRef, DebugInfoSize>> Sorted;
for (auto &E : SizeByObject)
Sorted.emplace_back(E.first(), E.second);
llvm::sort(Sorted.begin(), Sorted.end(), [](auto &LHS, auto &RHS) {
llvm::sort(Sorted, [](auto &LHS, auto &RHS) {
return LHS.second.Output > RHS.second.Output;
});

Expand Down
7 changes: 3 additions & 4 deletions llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ Error DebugFrameDataSubsection::commit(BinaryStreamWriter &Writer) const {
}

std::vector<FrameData> SortedFrames(Frames.begin(), Frames.end());
std::sort(SortedFrames.begin(), SortedFrames.end(),
[](const FrameData &LHS, const FrameData &RHS) {
return LHS.RvaStart < RHS.RvaStart;
});
llvm::sort(SortedFrames, [](const FrameData &LHS, const FrameData &RHS) {
return LHS.RvaStart < RHS.RvaStart;
});
if (auto EC = Writer.writeArray(makeArrayRef(SortedFrames)))
return EC;
return Error::success();
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ llvm::Error GsymCreator::finalize(llvm::raw_ostream &OS) {
Finalized = true;

// Sort function infos so we can emit sorted functions.
llvm::sort(Funcs.begin(), Funcs.end());
llvm::sort(Funcs);

// Don't let the string table indexes change by finalizing in order.
StrTab.finalizeInOrder();
Expand Down
9 changes: 4 additions & 5 deletions llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,10 @@ SymbolCache::findLineTable(uint16_t Modi) const {
}

// Sort EntryList, and add flattened contents to the line table.
std::sort(EntryList.begin(), EntryList.end(),
[](const std::vector<LineTableEntry> &LHS,
const std::vector<LineTableEntry> &RHS) {
return LHS[0].Addr < RHS[0].Addr;
});
llvm::sort(EntryList, [](const std::vector<LineTableEntry> &LHS,
const std::vector<LineTableEntry> &RHS) {
return LHS[0].Addr < RHS[0].Addr;
});
for (size_t I = 0; I < EntryList.size(); ++I)
llvm::append_range(ModuleLineTable, EntryList[I]);

Expand Down
9 changes: 4 additions & 5 deletions llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,10 @@ BlockFreqQuery::ResultTy BlockFreqQuery::operator()(Function &F) {

assert(IBBs.size() == BBFreqs.size() && "BB Count Mismatch");

llvm::sort(BBFreqs.begin(), BBFreqs.end(),
[](decltype(BBFreqs)::const_reference BBF,
decltype(BBFreqs)::const_reference BBS) {
return BBF.second > BBS.second ? true : false;
});
llvm::sort(BBFreqs, [](decltype(BBFreqs)::const_reference BBF,
decltype(BBFreqs)::const_reference BBS) {
return BBF.second > BBS.second ? true : false;
});

// ignoring number of direct calls in a BB
auto Topk = numBBToGet(BBFreqs.size());
Expand Down
11 changes: 5 additions & 6 deletions llvm/lib/FileCheck/FileCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1386,12 +1386,11 @@ void Pattern::printVariableDefs(const SourceMgr &SM,
}
// Sort variable captures by the order in which they matched the input.
// Ranges shouldn't be overlapping, so we can just compare the start.
std::sort(VarCaptures.begin(), VarCaptures.end(),
[](const VarCapture &A, const VarCapture &B) {
assert(A.Range.Start != B.Range.Start &&
"unexpected overlapping variable captures");
return A.Range.Start.getPointer() < B.Range.Start.getPointer();
});
llvm::sort(VarCaptures, [](const VarCapture &A, const VarCapture &B) {
assert(A.Range.Start != B.Range.Start &&
"unexpected overlapping variable captures");
return A.Range.Start.getPointer() < B.Range.Start.getPointer();
});
// Create notes for the sorted captures.
for (const VarCapture &VC : VarCaptures) {
SmallString<256> Msg;
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/IR/IRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,9 +1047,7 @@ Value *IRBuilderBase::CreatePreserveArrayAccessIndex(

Value *LastIndexV = getInt32(LastIndex);
Constant *Zero = ConstantInt::get(Type::getInt32Ty(Context), 0);
SmallVector<Value *, 4> IdxList;
for (unsigned I = 0; I < Dimension; ++I)
IdxList.push_back(Zero);
SmallVector<Value *, 4> IdxList(Dimension, Zero);
IdxList.push_back(LastIndexV);

Type *ResultType =
Expand Down
7 changes: 3 additions & 4 deletions llvm/lib/Object/COFFObjectFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1791,10 +1791,9 @@ Error ResourceSectionRef::load(const COFFObjectFile *O, const SectionRef &S) {
Relocs.reserve(OrigRelocs.size());
for (const coff_relocation &R : OrigRelocs)
Relocs.push_back(&R);
std::sort(Relocs.begin(), Relocs.end(),
[](const coff_relocation *A, const coff_relocation *B) {
return A->VirtualAddress < B->VirtualAddress;
});
llvm::sort(Relocs, [](const coff_relocation *A, const coff_relocation *B) {
return A->VirtualAddress < B->VirtualAddress;
});
return Error::success();
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Support/DebugCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void DebugCounter::push_back(const std::string &Val) {
void DebugCounter::print(raw_ostream &OS) const {
SmallVector<StringRef, 16> CounterNames(RegisteredCounters.begin(),
RegisteredCounters.end());
sort(CounterNames.begin(), CounterNames.end());
sort(CounterNames);

auto &Us = instance();
OS << "Counters and values:\n";
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,10 +775,10 @@ bool AMDGPUPromoteAllocaImpl::hasSufficientLocalMem(const Function &F) {
//
// FIXME: We should really do something to fix the addresses to a more optimal
// value instead
llvm::sort(AllocatedSizes.begin(), AllocatedSizes.end(),
[](std::pair<uint64_t, Align> LHS, std::pair<uint64_t, Align> RHS) {
return LHS.second < RHS.second;
});
llvm::sort(AllocatedSizes, [](std::pair<uint64_t, Align> LHS,
std::pair<uint64_t, Align> RHS) {
return LHS.second < RHS.second;
});

// Check how much local memory is being used by global objects
CurrentLocalMemUsage = 0;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/Hexagon/HexagonBlockRanges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void HexagonBlockRanges::RangeList::unionize(bool MergeAdjacent) {
if (empty())
return;

llvm::sort(begin(), end());
llvm::sort(*this);
iterator Iter = begin();

while (Iter != end()-1) {
Expand Down
24 changes: 11 additions & 13 deletions llvm/lib/TextAPI/MachO/TextStub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,12 @@ template <> struct MappingTraits<const InterfaceFile *> {
break;
}
}
llvm::sort(Section.Symbols.begin(), Section.Symbols.end());
llvm::sort(Section.Classes.begin(), Section.Classes.end());
llvm::sort(Section.ClassEHs.begin(), Section.ClassEHs.end());
llvm::sort(Section.IVars.begin(), Section.IVars.end());
llvm::sort(Section.WeakDefSymbols.begin(),
Section.WeakDefSymbols.end());
llvm::sort(Section.TLVSymbols.begin(), Section.TLVSymbols.end());
llvm::sort(Section.Symbols);
llvm::sort(Section.Classes);
llvm::sort(Section.ClassEHs);
llvm::sort(Section.IVars);
llvm::sort(Section.WeakDefSymbols);
llvm::sort(Section.TLVSymbols);
Exports.emplace_back(std::move(Section));
}

Expand Down Expand Up @@ -579,12 +578,11 @@ template <> struct MappingTraits<const InterfaceFile *> {
break;
}
}
llvm::sort(Section.Symbols.begin(), Section.Symbols.end());
llvm::sort(Section.Classes.begin(), Section.Classes.end());
llvm::sort(Section.ClassEHs.begin(), Section.ClassEHs.end());
llvm::sort(Section.IVars.begin(), Section.IVars.end());
llvm::sort(Section.WeakRefSymbols.begin(),
Section.WeakRefSymbols.end());
llvm::sort(Section.Symbols);
llvm::sort(Section.Classes);
llvm::sort(Section.ClassEHs);
llvm::sort(Section.IVars);
llvm::sort(Section.WeakRefSymbols);
Undefineds.emplace_back(std::move(Section));
}
}
Expand Down
19 changes: 9 additions & 10 deletions llvm/tools/llvm-cov/CoverageExporterJson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,15 @@ void CoverageExporterJson::renderRoot(ArrayRef<std::string> SourceFiles) {
SourceFiles, Options);
auto Files = renderFiles(Coverage, SourceFiles, FileReports, Options);
// Sort files in order of their names.
std::sort(Files.begin(), Files.end(),
[](const json::Value &A, const json::Value &B) {
const json::Object *ObjA = A.getAsObject();
const json::Object *ObjB = B.getAsObject();
assert(ObjA != nullptr && "Value A was not an Object");
assert(ObjB != nullptr && "Value B was not an Object");
const StringRef FilenameA = ObjA->getString("filename").getValue();
const StringRef FilenameB = ObjB->getString("filename").getValue();
return FilenameA.compare(FilenameB) < 0;
});
llvm::sort(Files, [](const json::Value &A, const json::Value &B) {
const json::Object *ObjA = A.getAsObject();
const json::Object *ObjB = B.getAsObject();
assert(ObjA != nullptr && "Value A was not an Object");
assert(ObjB != nullptr && "Value B was not an Object");
const StringRef FilenameA = ObjA->getString("filename").getValue();
const StringRef FilenameB = ObjB->getString("filename").getValue();
return FilenameA.compare(FilenameB) < 0;
});
auto Export = json::Object(
{{"files", std::move(Files)}, {"totals", renderSummary(Totals)}});
// Skip functions-level information if necessary.
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-cov/CoverageExporterLcov.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void renderBranchExecutionCounts(raw_ostream &OS,

// Sort branches based on line number to ensure branches corresponding to the
// same source line are counted together.
std::sort(Branches.begin(), Branches.end(), sortLine);
llvm::sort(Branches, sortLine);

auto NextBranch = Branches.begin();
auto EndBranch = Branches.end();
Expand Down
23 changes: 11 additions & 12 deletions llvm/tools/llvm-jitlink/llvm-jitlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,17 @@ static void dumpSectionContents(raw_ostream &OS, LinkGraph &G) {
for (auto &S : G.sections())
Sections.push_back(&S);

std::sort(Sections.begin(), Sections.end(),
[](const Section *LHS, const Section *RHS) {
if (llvm::empty(LHS->symbols()) && llvm::empty(RHS->symbols()))
return false;
if (llvm::empty(LHS->symbols()))
return false;
if (llvm::empty(RHS->symbols()))
return true;
SectionRange LHSRange(*LHS);
SectionRange RHSRange(*RHS);
return LHSRange.getStart() < RHSRange.getStart();
});
llvm::sort(Sections, [](const Section *LHS, const Section *RHS) {
if (llvm::empty(LHS->symbols()) && llvm::empty(RHS->symbols()))
return false;
if (llvm::empty(LHS->symbols()))
return false;
if (llvm::empty(RHS->symbols()))
return true;
SectionRange LHSRange(*LHS);
SectionRange RHSRange(*RHS);
return LHSRange.getStart() < RHSRange.getStart();
});

for (auto *S : Sections) {
OS << S->getName() << " content:";
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/TableGen/CodeGenRegisters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void CodeGenRegister::buildObjectGraph(CodeGenRegBank &RegBank) {
}
}

const StringRef CodeGenRegister::getName() const {
StringRef CodeGenRegister::getName() const {
assert(TheDef && "no def");
return TheDef->getName();
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/TableGen/CodeGenRegisters.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ namespace llvm {

CodeGenRegister(Record *R, unsigned Enum);

const StringRef getName() const;
StringRef getName() const;

// Extract more information from TheDef. This is used to build an object
// graph after all CodeGenRegister objects have been created.
Expand Down
4 changes: 1 addition & 3 deletions llvm/utils/TableGen/CodeGenTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,7 @@ CodeGenTarget::CodeGenTarget(RecordKeeper &records)
CodeGenTarget::~CodeGenTarget() {
}

const StringRef CodeGenTarget::getName() const {
return TargetRec->getName();
}
StringRef CodeGenTarget::getName() const { return TargetRec->getName(); }

/// getInstNamespace - Find and return the target machine's instruction
/// namespace. The namespace is cached because it is requested multiple times.
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/TableGen/CodeGenTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class CodeGenTarget {
~CodeGenTarget();

Record *getTargetRecord() const { return TargetRec; }
const StringRef getName() const;
StringRef getName() const;

/// getInstNamespace - Return the target-specific instruction namespace.
///
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/TableGen/DAGISelMatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ class CheckComplexPatMatcher : public Matcher {
const ComplexPattern &getPattern() const { return Pattern; }
unsigned getMatchNumber() const { return MatchNumber; }

const std::string getName() const { return Name; }
std::string getName() const { return Name; }
unsigned getFirstResult() const { return FirstResult; }

static bool classof(const Matcher *N) {
Expand Down
12 changes: 6 additions & 6 deletions llvm/utils/TableGen/GlobalISelEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ class OperandMatcher : public PredicateListMatcher<OperandPredicateMatcher> {
AllocatedTemporariesBaseID(AllocatedTemporariesBaseID) {}

bool hasSymbolicName() const { return !SymbolicName.empty(); }
const StringRef getSymbolicName() const { return SymbolicName; }
StringRef getSymbolicName() const { return SymbolicName; }
void setSymbolicName(StringRef Name) {
assert(SymbolicName.empty() && "Operand already has a symbolic name");
SymbolicName = std::string(Name);
Expand Down Expand Up @@ -2536,7 +2536,7 @@ class CopyRenderer : public OperandRenderer {
return R->getKind() == OR_Copy;
}

const StringRef getSymbolicName() const { return SymbolicName; }
StringRef getSymbolicName() const { return SymbolicName; }

void emitRenderOpcodes(MatchTable &Table, RuleMatcher &Rule) const override {
const OperandMatcher &Operand = Rule.getOperandMatcher(SymbolicName);
Expand Down Expand Up @@ -2603,7 +2603,7 @@ class CopyOrAddZeroRegRenderer : public OperandRenderer {
return R->getKind() == OR_CopyOrAddZeroReg;
}

const StringRef getSymbolicName() const { return SymbolicName; }
StringRef getSymbolicName() const { return SymbolicName; }

void emitRenderOpcodes(MatchTable &Table, RuleMatcher &Rule) const override {
const OperandMatcher &Operand = Rule.getOperandMatcher(SymbolicName);
Expand Down Expand Up @@ -2640,7 +2640,7 @@ class CopyConstantAsImmRenderer : public OperandRenderer {
return R->getKind() == OR_CopyConstantAsImm;
}

const StringRef getSymbolicName() const { return SymbolicName; }
StringRef getSymbolicName() const { return SymbolicName; }

void emitRenderOpcodes(MatchTable &Table, RuleMatcher &Rule) const override {
InstructionMatcher &InsnMatcher = Rule.getInstructionMatcher(SymbolicName);
Expand Down Expand Up @@ -2671,7 +2671,7 @@ class CopyFConstantAsFPImmRenderer : public OperandRenderer {
return R->getKind() == OR_CopyFConstantAsFPImm;
}

const StringRef getSymbolicName() const { return SymbolicName; }
StringRef getSymbolicName() const { return SymbolicName; }

void emitRenderOpcodes(MatchTable &Table, RuleMatcher &Rule) const override {
InstructionMatcher &InsnMatcher = Rule.getInstructionMatcher(SymbolicName);
Expand Down Expand Up @@ -2705,7 +2705,7 @@ class CopySubRegRenderer : public OperandRenderer {
return R->getKind() == OR_CopySubReg;
}

const StringRef getSymbolicName() const { return SymbolicName; }
StringRef getSymbolicName() const { return SymbolicName; }

void emitRenderOpcodes(MatchTable &Table, RuleMatcher &Rule) const override {
const OperandMatcher &Operand = Rule.getOperandMatcher(SymbolicName);
Expand Down
Loading

0 comments on commit bee6f06

Please sign in to comment.