1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[CodeView] Fix inline sites that are missing code offsets.

When an inline site has a starting code offset of 0, we sometimes
don't emit the starting offset.

Bug: https://bugs.llvm.org/show_bug.cgi?id=48377

Differential Revision: https://reviews.llvm.org/D92590
This commit is contained in:
Amy Huang 2020-12-03 09:03:55 -08:00
parent 2e1a73029c
commit 1dae873326
4 changed files with 4 additions and 7 deletions

View File

@ -563,10 +563,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
int LineDelta = CurSourceLoc.Line - LastSourceLoc.Line;
unsigned EncodedLineDelta = encodeSignedNumber(LineDelta);
unsigned CodeDelta = computeLabelDiff(Layout, LastLabel, Loc.getLabel());
if (CodeDelta == 0 && LineDelta != 0) {
compressAnnotation(BinaryAnnotationsOpCode::ChangeLineOffset, Buffer);
compressAnnotation(EncodedLineDelta, Buffer);
} else if (EncodedLineDelta < 0x8 && CodeDelta <= 0xf) {
if (EncodedLineDelta < 0x8 && CodeDelta <= 0xf) {
// The ChangeCodeOffsetAndLineOffset combination opcode is used when the
// encoded line delta uses 3 or fewer set bits and the code offset fits
// in one nibble.

View File

@ -2,7 +2,7 @@
# CHECK: InlineSiteSym {
# CHECK: BinaryAnnotations [
# CHECK: ChangeLineOffset: 1
# CHECK: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x0, LineOffset: 1}
# CHECK: ChangeCodeLength: 0x2
# CHECK: ]
# CHECK: }

View File

@ -23,7 +23,7 @@
# CODEVIEW: S_INLINESITE [size = 26]
# CODEVIEW-NEXT: inlinee = 0x1002 (do_exit), parent = 0, end = 0
# CODEVIEW-NEXT: 0602 line 1 (+1)
# CODEVIEW-NEXT: 0B20 code 0x0 (+0x0) line 1 (+1)
# CODEVIEW-NEXT: 0409 code end 0x9 (+0x9)
# CODEVIEW-NEXT: 0B21 code 0xA (+0x1) line 2 (+1)
# CODEVIEW-NEXT: 0B28 code 0x12 (+0x8) line 3 (+1)

View File

@ -34,7 +34,7 @@
# CODEVIEW: S_INLINESITE [size = 26]
# CODEVIEW-NEXT: inlinee = 0x1002 (do_exit), parent = 0, end = 0
# CODEVIEW-NEXT: 0602 line 1 (+1)
# CODEVIEW-NEXT: 0B20 code 0x0 (+0x0) line 1 (+1)
# CODEVIEW-NEXT: 0409 code end 0x9 (+0x9)
# CODEVIEW-NEXT: 0B21 code 0xA (+0x1) line 2 (+1)
# CODEVIEW-NEXT: 0B28 code 0x12 (+0x8) line 3 (+1)