Skip to content

Commit 399bc48

Browse files
committed
[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
1 parent b570f82 commit 399bc48

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

llvm/lib/MC/MCCodeView.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
563563
int LineDelta = CurSourceLoc.Line - LastSourceLoc.Line;
564564
unsigned EncodedLineDelta = encodeSignedNumber(LineDelta);
565565
unsigned CodeDelta = computeLabelDiff(Layout, LastLabel, Loc.getLabel());
566-
if (CodeDelta == 0 && LineDelta != 0) {
567-
compressAnnotation(BinaryAnnotationsOpCode::ChangeLineOffset, Buffer);
568-
compressAnnotation(EncodedLineDelta, Buffer);
569-
} else if (EncodedLineDelta < 0x8 && CodeDelta <= 0xf) {
566+
if (EncodedLineDelta < 0x8 && CodeDelta <= 0xf) {
570567
// The ChangeCodeOffsetAndLineOffset combination opcode is used when the
571568
// encoded line delta uses 3 or fewer set bits and the code offset fits
572569
// in one nibble.

llvm/test/MC/COFF/cv-inline-linetable-infloop.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# CHECK: InlineSiteSym {
44
# CHECK: BinaryAnnotations [
5-
# CHECK: ChangeLineOffset: 1
5+
# CHECK: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x0, LineOffset: 1}
66
# CHECK: ChangeCodeLength: 0x2
77
# CHECK: ]
88
# CHECK: }

llvm/test/MC/COFF/cv-loc-unreachable-2.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

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

llvm/test/MC/COFF/cv-loc-unreachable.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

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

0 commit comments

Comments
 (0)