Skip to content

Commit d2613de

Browse files
authored
Merge branch 'main' into loop-define-bitconvert
2 parents 690dd15 + 6257621 commit d2613de

File tree

22 files changed

+59
-66
lines changed

22 files changed

+59
-66
lines changed

llvm/include/llvm/Analysis/Lint.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,20 @@ class Function;
2929
///
3030
/// This should only be used for debugging, because it plays games with
3131
/// PassManagers and stuff.
32-
void lintModule(const Module &M);
32+
void lintModule(const Module &M, bool AbortOnError = false);
3333

3434
// Lint a function.
35-
void lintFunction(const Function &F);
35+
void lintFunction(const Function &F, bool AbortOnError = false);
3636

3737
class LintPass : public PassInfoMixin<LintPass> {
38+
const bool AbortOnError;
39+
3840
public:
41+
LintPass(bool AbortOnError) : AbortOnError(AbortOnError) {}
3942
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
43+
44+
void printPipeline(raw_ostream &OS,
45+
function_ref<StringRef(StringRef)> MapClassName2PassName);
4046
};
4147

4248
} // namespace llvm

llvm/include/llvm/CodeGen/TileShapeInfo.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ class ShapeT {
4848
ColImm(InvalidImmShape) {
4949
assert(ShapesOperands.size() % 2 == 0 && "Miss row or col!");
5050

51-
for (auto *Shape : ShapesOperands)
52-
Shapes.push_back(Shape);
51+
llvm::append_range(Shapes, ShapesOperands);
5352

5453
if (MRI)
5554
deduceImm(MRI);

llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Legality.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class ShuffleMask {
4343
static ShuffleMask getIdentity(unsigned Sz) {
4444
IndicesVecT Indices;
4545
Indices.reserve(Sz);
46-
for (auto Idx : seq<int>(0, (int)Sz))
47-
Indices.push_back(Idx);
46+
llvm::append_range(Indices, seq<int>(0, (int)Sz));
4847
return ShuffleMask(std::move(Indices));
4948
}
5049
/// \Returns true if the mask is a perfect identity mask with consecutive

llvm/lib/Analysis/Lint.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@
7878

7979
using namespace llvm;
8080

81-
static const char LintAbortOnErrorArgName[] = "lint-abort-on-error";
82-
static cl::opt<bool>
83-
LintAbortOnError(LintAbortOnErrorArgName, cl::init(false),
84-
cl::desc("In the Lint pass, abort on errors."));
85-
8681
namespace {
8782
namespace MemRef {
8883
static const unsigned Read = 1;
@@ -747,20 +742,26 @@ PreservedAnalyses LintPass::run(Function &F, FunctionAnalysisManager &AM) {
747742
Lint L(Mod, DL, AA, AC, DT, TLI);
748743
L.visit(F);
749744
dbgs() << L.MessagesStr.str();
750-
if (LintAbortOnError && !L.MessagesStr.str().empty())
751-
report_fatal_error(Twine("Linter found errors, aborting. (enabled by --") +
752-
LintAbortOnErrorArgName + ")",
753-
false);
745+
if (AbortOnError && !L.MessagesStr.str().empty())
746+
report_fatal_error(
747+
"linter found errors, aborting. (enabled by abort-on-error)", false);
754748
return PreservedAnalyses::all();
755749
}
756750

751+
void LintPass::printPipeline(
752+
raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
753+
PassInfoMixin<LintPass>::printPipeline(OS, MapClassName2PassName);
754+
if (AbortOnError)
755+
OS << "<abort-on-error>";
756+
}
757+
757758
//===----------------------------------------------------------------------===//
758759
// Implement the public interfaces to this file...
759760
//===----------------------------------------------------------------------===//
760761

761762
/// lintFunction - Check a function for errors, printing messages on stderr.
762763
///
763-
void llvm::lintFunction(const Function &f) {
764+
void llvm::lintFunction(const Function &f, bool AbortOnError) {
764765
Function &F = const_cast<Function &>(f);
765766
assert(!F.isDeclaration() && "Cannot lint external functions");
766767

@@ -775,14 +776,14 @@ void llvm::lintFunction(const Function &f) {
775776
AA.registerFunctionAnalysis<TypeBasedAA>();
776777
return AA;
777778
});
778-
LintPass().run(F, FAM);
779+
LintPass(AbortOnError).run(F, FAM);
779780
}
780781

781782
/// lintModule - Check a module for errors, printing messages on stderr.
782783
///
783-
void llvm::lintModule(const Module &M) {
784+
void llvm::lintModule(const Module &M, bool AbortOnError) {
784785
for (const Function &F : M) {
785786
if (!F.isDeclaration())
786-
lintFunction(F);
787+
lintFunction(F, AbortOnError);
787788
}
788789
}

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3339,10 +3339,8 @@ Error BitcodeReader::parseConstants() {
33393339
if (Record.empty())
33403340
return error("Invalid aggregate record");
33413341

3342-
unsigned Size = Record.size();
33433342
SmallVector<unsigned, 16> Elts;
3344-
for (unsigned i = 0; i != Size; ++i)
3345-
Elts.push_back(Record[i]);
3343+
llvm::append_range(Elts, Record);
33463344

33473345
if (isa<StructType>(CurTy)) {
33483346
V = BitcodeConstant::create(

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,8 +1209,7 @@ void ModuleBitcodeWriter::writeTypeTable() {
12091209
TypeVals.push_back(TET->getNumTypeParameters());
12101210
for (Type *InnerTy : TET->type_params())
12111211
TypeVals.push_back(VE.getTypeID(InnerTy));
1212-
for (unsigned IntParam : TET->int_params())
1213-
TypeVals.push_back(IntParam);
1212+
llvm::append_range(TypeVals, TET->int_params());
12141213
break;
12151214
}
12161215
case Type::TypedPointerTyID:
@@ -4303,10 +4302,8 @@ static void writeFunctionHeapProfileRecords(
43034302
}
43044303
for (auto Id : CI.StackIdIndices)
43054304
Record.push_back(GetStackIndex(Id));
4306-
if (!PerModule) {
4307-
for (auto V : CI.Clones)
4308-
Record.push_back(V);
4309-
}
4305+
if (!PerModule)
4306+
llvm::append_range(Record, CI.Clones);
43104307
Stream.EmitRecord(PerModule ? bitc::FS_PERMODULE_CALLSITE_INFO
43114308
: bitc::FS_COMBINED_CALLSITE_INFO,
43124309
Record, CallsiteAbbrev);
@@ -4326,10 +4323,8 @@ static void writeFunctionHeapProfileRecords(
43264323
assert(CallStackCount <= CallStackPos.size());
43274324
Record.push_back(CallStackPos[CallStackCount++]);
43284325
}
4329-
if (!PerModule) {
4330-
for (auto V : AI.Versions)
4331-
Record.push_back(V);
4332-
}
4326+
if (!PerModule)
4327+
llvm::append_range(Record, AI.Versions);
43334328
assert(AI.ContextSizeInfos.empty() ||
43344329
AI.ContextSizeInfos.size() == AI.MIBs.size());
43354330
// Optionally emit the context size information if it exists.

llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,7 @@ void LVPatterns::addGenericPatterns(StringSet<> &Patterns) {
445445
}
446446

447447
void LVPatterns::addOffsetPatterns(const LVOffsetSet &Patterns) {
448-
for (const LVOffset &Entry : Patterns)
449-
OffsetMatchInfo.push_back(Entry);
448+
llvm::append_range(OffsetMatchInfo, Patterns);
450449
if (OffsetMatchInfo.size()) {
451450
options().setSelectOffsetPattern();
452451
options().setSelectExecute();

llvm/lib/DebugInfo/LogicalView/Core/LVSymbol.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ void LVSymbol::getLocations(LVLocations &LocationList) const {
182182
if (!Locations)
183183
return;
184184

185-
for (LVLocation *Location : *Locations)
186-
LocationList.push_back(Location);
185+
llvm::append_range(LocationList, *Locations);
187186
}
188187

189188
// Calculate coverage factor.

llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ void LVCodeViewReader::cacheRelocations() {
163163
const coff_section *CoffSection = getObj().getCOFFSection(Section);
164164

165165
auto &RM = RelocMap[CoffSection];
166-
for (const RelocationRef &Relocacion : Section.relocations())
167-
RM.push_back(Relocacion);
166+
llvm::append_range(RM, Section.relocations());
168167

169168
// Sort relocations by address.
170169
llvm::sort(RM, [](RelocationRef L, RelocationRef R) {

llvm/lib/FileCheck/FileCheck.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,13 +1640,11 @@ static const char *DefaultCommentPrefixes[] = {"COM", "RUN"};
16401640

16411641
static void addDefaultPrefixes(FileCheckRequest &Req) {
16421642
if (Req.CheckPrefixes.empty()) {
1643-
for (const char *Prefix : DefaultCheckPrefixes)
1644-
Req.CheckPrefixes.push_back(Prefix);
1643+
llvm::append_range(Req.CheckPrefixes, DefaultCheckPrefixes);
16451644
Req.IsDefaultCheckPrefix = true;
16461645
}
16471646
if (Req.CommentPrefixes.empty())
1648-
for (const char *Prefix : DefaultCommentPrefixes)
1649-
Req.CommentPrefixes.push_back(Prefix);
1647+
llvm::append_range(Req.CommentPrefixes, DefaultCommentPrefixes);
16501648
}
16511649

16521650
struct PrefixMatcher {

0 commit comments

Comments
 (0)