[WebAssembly] MC: Add compile-twice test and fix corresponding bug

Differential Revision: https://reviews.llvm.org/D47398

llvm-svn: 333494
This commit is contained in:
Sam Clegg 2018-05-30 02:57:20 +00:00
parent 71fd27043e
commit 105bdc2557
3 changed files with 16 additions and 1 deletions

View File

@ -105,6 +105,7 @@ void MCContext::reset() {
MachOUniquingMap.clear();
ELFUniquingMap.clear();
COFFUniquingMap.clear();
WasmUniquingMap.clear();
NextID.clear();
AllowTemporaryLabels = true;

View File

@ -270,9 +270,9 @@ private:
Globals.clear();
DataSegments.clear();
SectionFunctions.clear();
MCObjectWriter::reset();
NumFunctionImports = 0;
NumGlobalImports = 0;
MCObjectWriter::reset();
}
void writeHeader(const MCAssembler &Asm);

View File

@ -0,0 +1,14 @@
; Check that there is no persistent state in the WabAssembly emitter that cause
; issues when reusing the pass manager.
; RUN: llc -mtriple=wasm32-unknown-unknown -compile-twice -filetype=obj %s -o -
; Force the creation of a DWARF section
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4}
@myglobal = global i32 0, align 4
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "LLVM", isOptimized: true, emissionKind: FullDebug)
!1 = !DIFile(filename: "<stdin>", directory: "/")
!3 = !{i32 2, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}