Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,32 +240,28 @@ struct BinaryAnnotationIterator
if (Annotations.empty())
return -1;

uint8_t FirstByte = Annotations.front();
Annotations = Annotations.drop_front();
uint8_t FirstByte = Annotations.consume_front();

if ((FirstByte & 0x80) == 0x00)
return FirstByte;

if (Annotations.empty())
return -1;

uint8_t SecondByte = Annotations.front();
Annotations = Annotations.drop_front();
uint8_t SecondByte = Annotations.consume_front();

if ((FirstByte & 0xC0) == 0x80)
return ((FirstByte & 0x3F) << 8) | SecondByte;

if (Annotations.empty())
return -1;

uint8_t ThirdByte = Annotations.front();
Annotations = Annotations.drop_front();
uint8_t ThirdByte = Annotations.consume_front();

if (Annotations.empty())
return -1;

uint8_t FourthByte = Annotations.front();
Annotations = Annotations.drop_front();
uint8_t FourthByte = Annotations.consume_front();

if ((FirstByte & 0xE0) == 0xC0)
return ((FirstByte & 0x1F) << 24) | (SecondByte << 16) |
Expand Down
19 changes: 7 additions & 12 deletions llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7513,11 +7513,9 @@ std::vector<FunctionSummary::ParamAccess>
ModuleSummaryIndexBitcodeReader::parseParamAccesses(ArrayRef<uint64_t> Record) {
auto ReadRange = [&]() {
APInt Lower(FunctionSummary::ParamAccess::RangeWidth,
BitcodeReader::decodeSignRotatedValue(Record.front()));
Record = Record.drop_front();
BitcodeReader::decodeSignRotatedValue(Record.consume_front()));
APInt Upper(FunctionSummary::ParamAccess::RangeWidth,
BitcodeReader::decodeSignRotatedValue(Record.front()));
Record = Record.drop_front();
BitcodeReader::decodeSignRotatedValue(Record.consume_front()));
ConstantRange Range{Lower, Upper};
assert(!Range.isFullSet());
assert(!Range.isUpperSignWrapped());
Expand All @@ -7528,16 +7526,13 @@ ModuleSummaryIndexBitcodeReader::parseParamAccesses(ArrayRef<uint64_t> Record) {
while (!Record.empty()) {
PendingParamAccesses.emplace_back();
FunctionSummary::ParamAccess &ParamAccess = PendingParamAccesses.back();
ParamAccess.ParamNo = Record.front();
Record = Record.drop_front();
ParamAccess.ParamNo = Record.consume_front();
ParamAccess.Use = ReadRange();
ParamAccess.Calls.resize(Record.front());
Record = Record.drop_front();
ParamAccess.Calls.resize(Record.consume_front());
for (auto &Call : ParamAccess.Calls) {
Call.ParamNo = Record.front();
Record = Record.drop_front();
Call.Callee = std::get<0>(getValueInfoFromValueId(Record.front()));
Record = Record.drop_front();
Call.ParamNo = Record.consume_front();
Call.Callee =
std::get<0>(getValueInfoFromValueId(Record.consume_front()));
Call.Offsets = ReadRange();
}
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2085,8 +2085,8 @@ TypeIndex CodeViewDebug::lowerTypeFunction(const DISubroutineType *Ty) {
ArrayRef<TypeIndex> ArgTypeIndices = {};
if (!ReturnAndArgTypeIndices.empty()) {
auto ReturnAndArgTypesRef = ArrayRef(ReturnAndArgTypeIndices);
ReturnTypeIndex = ReturnAndArgTypesRef.front();
ArgTypeIndices = ReturnAndArgTypesRef.drop_front();
ReturnTypeIndex = ReturnAndArgTypesRef.consume_front();
ArgTypeIndices = ReturnAndArgTypesRef;
}

ArgListRecord ArgListRec(TypeRecordKind::ArgList, ArgTypeIndices);
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/MachinePostDominators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ MachineBasicBlock *MachinePostDominatorTree::findNearestCommonDominator(
ArrayRef<MachineBasicBlock *> Blocks) const {
assert(!Blocks.empty());

MachineBasicBlock *NCD = Blocks.front();
for (MachineBasicBlock *BB : Blocks.drop_front()) {
MachineBasicBlock *NCD = Blocks.consume_front();
for (MachineBasicBlock *BB : Blocks) {
NCD = Base::findNearestCommonDominator(NCD, BB);

// Stop when the root is reached.
Expand Down
12 changes: 6 additions & 6 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1511,8 +1511,8 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
/// \returns true if all of the values in \p VL have the same type or false
/// otherwise.
static bool allSameType(ArrayRef<Value *> VL) {
Type *Ty = VL.front()->getType();
return all_of(VL.drop_front(), [&](Value *V) { return V->getType() == Ty; });
Type *Ty = VL.consume_front()->getType();
return all_of(VL, [&](Value *V) { return V->getType() == Ty; });
}

/// \returns True if in-tree use also needs extract. This refers to
Expand Down Expand Up @@ -5567,8 +5567,8 @@ static bool arePointersCompatible(Value *Ptr1, Value *Ptr2,
/// Calculates minimal alignment as a common alignment.
template <typename T>
static Align computeCommonAlignment(ArrayRef<Value *> VL) {
Align CommonAlignment = cast<T>(VL.front())->getAlign();
for (Value *V : VL.drop_front())
Align CommonAlignment = cast<T>(VL.consume_front())->getAlign();
for (Value *V : VL)
CommonAlignment = std::min(CommonAlignment, cast<T>(V)->getAlign());
return CommonAlignment;
}
Expand Down Expand Up @@ -9483,8 +9483,8 @@ class PHIHandler {
ArrayRef<unsigned> IncomingValues = P.second;
if (IncomingValues.size() <= 1)
continue;
unsigned BasicI = IncomingValues.front();
for (unsigned I : IncomingValues.drop_front()) {
unsigned BasicI = IncomingValues.consume_front();
for (unsigned I : IncomingValues) {
assert(all_of(enumerate(Operands[I]),
[&](const auto &Data) {
return !Data.value() ||
Expand Down