[llvm-branch-commits] [llvm-branch] r294479 - Merging r292949:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Feb 8 09:14:38 PST 2017
Author: hans
Date: Wed Feb 8 11:14:38 2017
New Revision: 294479
URL: http://llvm.org/viewvc/llvm-project?rev=294479&view=rev
Log:
Merging r292949:
------------------------------------------------------------------------
r292949 | rnk | 2017-01-24 08:57:55 -0800 (Tue, 24 Jan 2017) | 6 lines
[CodeView] Fix off-by-one error in def range gap emission
Also fixes a much worse bug where we emitted the wrong gap size for the
def range uncovered by the test for this issue.
Fixes PR31726.
------------------------------------------------------------------------
Modified:
llvm/branches/release_40/ (props changed)
llvm/branches/release_40/lib/MC/MCCodeView.cpp
llvm/branches/release_40/test/MC/COFF/cv-def-range-gap.s
Propchange: llvm/branches/release_40/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 8 11:14:38 2017
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,291858-291859,291863,291875,291909,291918,291966,291968,291979,292117,292133,292167,292169-292170,292242,292254-292255,292280,292323,292444,292467,292516,292583,292624-292625,292641,292651,292667,292711-292713,292758,293017,293021,293025,293230,293259,293291,293293,293309,293345,293417,293522,293542,293629,293635,293658,293673,293727,293730,294102,294203,294267,294318,294348-294349,294357
+/llvm/trunk:155241,291858-291859,291863,291875,291909,291918,291966,291968,291979,292117,292133,292167,292169-292170,292242,292254-292255,292280,292323,292444,292467,292516,292583,292624-292625,292641,292651,292667,292711-292713,292758,292949,293017,293021,293025,293230,293259,293291,293293,293309,293345,293417,293522,293542,293629,293635,293658,293673,293727,293730,294102,294203,294267,294318,294348-294349,294357
Modified: llvm/branches/release_40/lib/MC/MCCodeView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_40/lib/MC/MCCodeView.cpp?rev=294479&r1=294478&r2=294479&view=diff
==============================================================================
--- llvm/branches/release_40/lib/MC/MCCodeView.cpp (original)
+++ llvm/branches/release_40/lib/MC/MCCodeView.cpp Wed Feb 8 11:14:38 2017
@@ -509,17 +509,17 @@ void CodeViewContext::encodeDefRange(MCA
// are artificially constructing.
size_t RecordSize = FixedSizePortion.size() +
sizeof(LocalVariableAddrRange) + 4 * NumGaps;
- // Write out the recrod size.
- support::endian::Writer<support::little>(OS).write<uint16_t>(RecordSize);
+ // Write out the record size.
+ LEWriter.write<uint16_t>(RecordSize);
// Write out the fixed size prefix.
OS << FixedSizePortion;
// Make space for a fixup that will eventually have a section relative
// relocation pointing at the offset where the variable becomes live.
Fixups.push_back(MCFixup::create(Contents.size(), BE, FK_SecRel_4));
- Contents.resize(Contents.size() + 4); // Fixup for code start.
+ LEWriter.write<uint32_t>(0); // Fixup for code start.
// Make space for a fixup that will record the section index for the code.
Fixups.push_back(MCFixup::create(Contents.size(), BE, FK_SecRel_2));
- Contents.resize(Contents.size() + 2); // Fixup for section index.
+ LEWriter.write<uint16_t>(0); // Fixup for section index.
// Write down the range's extent.
LEWriter.write<uint16_t>(Chunk);
@@ -529,7 +529,7 @@ void CodeViewContext::encodeDefRange(MCA
} while (RangeSize > 0);
// Emit the gaps afterwards.
- assert((NumGaps == 0 || Bias < MaxDefRange) &&
+ assert((NumGaps == 0 || Bias <= MaxDefRange) &&
"large ranges should not have gaps");
unsigned GapStartOffset = GapAndRangeSizes[I].second;
for (++I; I != J; ++I) {
@@ -537,7 +537,7 @@ void CodeViewContext::encodeDefRange(MCA
assert(I < GapAndRangeSizes.size());
std::tie(GapSize, RangeSize) = GapAndRangeSizes[I];
LEWriter.write<uint16_t>(GapStartOffset);
- LEWriter.write<uint16_t>(RangeSize);
+ LEWriter.write<uint16_t>(GapSize);
GapStartOffset += GapSize + RangeSize;
}
}
Modified: llvm/branches/release_40/test/MC/COFF/cv-def-range-gap.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_40/test/MC/COFF/cv-def-range-gap.s?rev=294479&r1=294478&r2=294479&view=diff
==============================================================================
--- llvm/branches/release_40/test/MC/COFF/cv-def-range-gap.s (original)
+++ llvm/branches/release_40/test/MC/COFF/cv-def-range-gap.s Wed Feb 8 11:14:38 2017
@@ -38,6 +38,19 @@
# CHECK-NEXT: Range: 0x1
# CHECK-NEXT: }
# CHECK-NEXT: }
+# CHECK-NEXT: DefRangeRegister {
+# CHECK-NEXT: Register: 23
+# CHECK-NEXT: MayHaveNoName: 0
+# CHECK-NEXT: LocalVariableAddrRange {
+# CHECK-NEXT: OffsetStart: .text+0x2001C
+# CHECK-NEXT: ISectStart: 0x0
+# CHECK-NEXT: Range: 0xF000
+# CHECK-NEXT: }
+# CHECK-NEXT: LocalVariableAddrGap [
+# CHECK-NEXT: GapStartOffset: 0x1
+# CHECK-NEXT: Range: 0xEFFE
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
.text
f: # @f
@@ -62,6 +75,16 @@ f:
.Lbegin3:
nop
.Lend3:
+
+ # Create a range that is exactly 0xF000 bytes long with a gap in the
+ # middle.
+.Lbegin4:
+ nop
+.Lend4:
+ .fill 0xeffe, 1, 0x90
+.Lbegin5:
+ nop
+.Lend5:
ret
.Lfunc_end0:
@@ -94,6 +117,7 @@ f:
.asciz "p"
.Ltmp19:
.cv_def_range .Lbegin0 .Lend0 .Lbegin1 .Lend1 .Lbegin2 .Lend2 .Lbegin3 .Lend3, "A\021\027\000\000\000"
+ .cv_def_range .Lbegin4 .Lend4 .Lbegin5 .Lend5, "A\021\027\000\000\000"
.short 2 # Record length
.short 4431 # Record kind: S_PROC_ID_END
.Ltmp15:
More information about the llvm-branch-commits
mailing list