Skip to content

Commit 105bdc2

Browse files
committedMay 30, 2018
[WebAssembly] MC: Add compile-twice test and fix corresponding bug
Differential Revision: https://reviews.llvm.org/D47398 llvm-svn: 333494
1 parent 71fd270 commit 105bdc2

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed
 

‎llvm/lib/MC/MCContext.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ void MCContext::reset() {
105105
MachOUniquingMap.clear();
106106
ELFUniquingMap.clear();
107107
COFFUniquingMap.clear();
108+
WasmUniquingMap.clear();
108109

109110
NextID.clear();
110111
AllowTemporaryLabels = true;

‎llvm/lib/MC/WasmObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ class WasmObjectWriter : public MCObjectWriter {
270270
Globals.clear();
271271
DataSegments.clear();
272272
SectionFunctions.clear();
273-
MCObjectWriter::reset();
274273
NumFunctionImports = 0;
275274
NumGlobalImports = 0;
275+
MCObjectWriter::reset();
276276
}
277277

278278
void writeHeader(const MCAssembler &Asm);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; Check that there is no persistent state in the WabAssembly emitter that cause
2+
; issues when reusing the pass manager.
3+
; RUN: llc -mtriple=wasm32-unknown-unknown -compile-twice -filetype=obj %s -o -
4+
5+
; Force the creation of a DWARF section
6+
!llvm.dbg.cu = !{!0}
7+
!llvm.module.flags = !{!3, !4}
8+
9+
@myglobal = global i32 0, align 4
10+
11+
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "LLVM", isOptimized: true, emissionKind: FullDebug)
12+
!1 = !DIFile(filename: "<stdin>", directory: "/")
13+
!3 = !{i32 2, !"Dwarf Version", i32 4}
14+
!4 = !{i32 2, !"Debug Info Version", i32 3}

0 commit comments

Comments
 (0)