[llvm-branch-commits] [llvm] 399bc48 - [CodeView] Fix inline sites that are missing code offsets.

Amy Huang via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Dec 7 13:06:30 PST 2020


Author: Amy Huang
Date: 2020-12-07T13:01:53-08:00
New Revision: 399bc48eccf0d983a8a4644c12ed9cc21ff33f33

URL: https://github.com/llvm/llvm-project/commit/399bc48eccf0d983a8a4644c12ed9cc21ff33f33
DIFF: https://github.com/llvm/llvm-project/commit/399bc48eccf0d983a8a4644c12ed9cc21ff33f33.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/MC/MCCodeView.cpp
    llvm/test/MC/COFF/cv-inline-linetable-infloop.s
    llvm/test/MC/COFF/cv-loc-unreachable-2.s
    llvm/test/MC/COFF/cv-loc-unreachable.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp
index 7849196432b8..3da1a9c3e331 100644
--- a/llvm/lib/MC/MCCodeView.cpp
+++ b/llvm/lib/MC/MCCodeView.cpp
@@ -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.

diff  --git a/llvm/test/MC/COFF/cv-inline-linetable-infloop.s b/llvm/test/MC/COFF/cv-inline-linetable-infloop.s
index 3802a0eeda7e..6246623cd9be 100644
--- a/llvm/test/MC/COFF/cv-inline-linetable-infloop.s
+++ b/llvm/test/MC/COFF/cv-inline-linetable-infloop.s
@@ -2,7 +2,7 @@
 
 # CHECK:    InlineSiteSym {
 # CHECK:      BinaryAnnotations [
-# CHECK:        ChangeLineOffset: 1
+# CHECK:        ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x0, LineOffset: 1}
 # CHECK:        ChangeCodeLength: 0x2
 # CHECK:      ]
 # CHECK:    }

diff  --git a/llvm/test/MC/COFF/cv-loc-unreachable-2.s b/llvm/test/MC/COFF/cv-loc-unreachable-2.s
index 2906622ddd7d..4e5b331dfd61 100644
--- a/llvm/test/MC/COFF/cv-loc-unreachable-2.s
+++ b/llvm/test/MC/COFF/cv-loc-unreachable-2.s
@@ -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)

diff  --git a/llvm/test/MC/COFF/cv-loc-unreachable.s b/llvm/test/MC/COFF/cv-loc-unreachable.s
index 333fb4523f5b..f35ed3055307 100644
--- a/llvm/test/MC/COFF/cv-loc-unreachable.s
+++ b/llvm/test/MC/COFF/cv-loc-unreachable.s
@@ -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)


        


More information about the llvm-branch-commits mailing list