Skip to content

Commit ce3e869

Browse files
committed
Merge from 'main' to 'sycl-web' (34 commits)
CONFLICT (content): Merge conflict in clang/include/clang/Driver/Options.td
2 parents 7324841 + 0bb3aaf commit ce3e869

File tree

129 files changed

+3961
-3061
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+3961
-3061
lines changed

bolt/lib/Core/BinaryContext.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -778,9 +778,8 @@ BinaryContext::getOrCreateJumpTable(BinaryFunction &Function, uint64_t Address,
778778
// Prevent associating a jump table to a specific fragment twice.
779779
// This simple check arises from the assumption: no more than 2 fragments.
780780
if (JT->Parents.size() == 1 && JT->Parents[0] != &Function) {
781-
bool SameFunction = isFragmentOf(JT->Parents[0], &Function) ||
782-
isFragmentOf(&Function, JT->Parents[0]);
783-
assert(SameFunction &&
781+
assert((isFragmentOf(JT->Parents[0], &Function) ||
782+
isFragmentOf(&Function, JT->Parents[0])) &&
784783
"cannot re-use jump table of a different function");
785784
// Duplicate the entry for the parent function for easy access
786785
JT->Parents.push_back(&Function);

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -628,44 +628,47 @@ void DWARFRewriter::updateUnitDebugInfo(
628628
Unit.getContext().isLittleEndian(), 0);
629629
DWARFExpression LocExpr(Data, Unit.getAddressByteSize(),
630630
Unit.getFormParams().Format);
631-
uint32_t PrevOffset = 0;
632-
constexpr uint32_t SizeOfOpcode = 1;
633-
constexpr uint32_t SizeOfForm = 1;
631+
uint32_t PrevEndOffset = 0;
632+
uint32_t CurrEndOffset = 0;
633+
constexpr uint32_t SizeOfOP = 1;
634+
constexpr uint32_t SizeOfSizeField = 1;
635+
int32_t SizeDiff = 0;
636+
637+
// Encoding [size of expression] [opcode] [value] [opcode] [value]
634638
for (auto &Expr : LocExpr) {
639+
PrevEndOffset = CurrEndOffset;
640+
CurrEndOffset = Expr.getEndOffset();
635641
if (!(Expr.getCode() == dwarf::DW_OP_GNU_addr_index ||
636642
Expr.getCode() == dwarf::DW_OP_addrx))
637643
continue;
638-
639644
const uint64_t Index = Expr.getRawOperand(0);
640645
Optional<object::SectionedAddress> EntryAddress =
641646
Unit.getAddrOffsetSectionItem(Index);
642647
assert(EntryAddress && "Address is not found.");
643648
assert(Index <= std::numeric_limits<uint32_t>::max() &&
644649
"Invalid Operand Index.");
645650
if (Expr.getCode() == dwarf::DW_OP_addrx) {
646-
const uint32_t EncodingSize =
647-
Expr.getOperandEndOffset(0) - PrevOffset - SizeOfOpcode;
651+
const uint32_t EncodingSize = CurrEndOffset - PrevEndOffset - 1;
648652
const uint32_t Index = AddrWriter->getIndexFromAddress(
649653
EntryAddress->Address, Unit);
650654
// Encoding new size.
651655
SmallString<8> Tmp;
652656
raw_svector_ostream OSE(Tmp);
653657
encodeULEB128(Index, OSE);
654-
DebugInfoPatcher.addUDataPatch(AttrOffset, Tmp.size() + 1, 1);
655-
DebugInfoPatcher.addUDataPatch(AttrOffset + PrevOffset +
656-
SizeOfOpcode + SizeOfForm,
658+
SizeDiff += Tmp.size() - EncodingSize;
659+
DebugInfoPatcher.addUDataPatch(AttrOffset + PrevEndOffset +
660+
SizeOfOP + SizeOfSizeField,
657661
Index, EncodingSize);
658662
} else {
659663
// TODO: Re-do this as DWARF5.
660664
AddrWriter->addIndexAddress(EntryAddress->Address,
661665
static_cast<uint32_t>(Index), Unit);
662666
}
663-
if (Expr.getDescription().Op[1] ==
664-
DWARFExpression::Operation::SizeNA)
665-
PrevOffset = Expr.getOperandEndOffset(0);
666-
else
667-
PrevOffset = Expr.getOperandEndOffset(1);
668667
}
668+
// Update the size of the experssion.
669+
if (SizeDiff)
670+
DebugInfoPatcher.addUDataPatch(AttrOffset,
671+
SizeDiff + CurrEndOffset, 1);
669672
}
670673
}
671674
} else if (Optional<AttrInfo> AttrVal =

0 commit comments

Comments
 (0)