diff options
-rw-r--r-- | llvm/lib/MC/MCContext.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/MC/WasmObjectWriter.cpp | 2 | ||||
-rw-r--r-- | llvm/test/MC/WebAssembly/compile-twice.ll | 14 |
3 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index da2f0d4e60b..5c4d67b10dd 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -105,6 +105,7 @@ void MCContext::reset() { MachOUniquingMap.clear(); ELFUniquingMap.clear(); COFFUniquingMap.clear(); + WasmUniquingMap.clear(); NextID.clear(); AllowTemporaryLabels = true; diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp index a9ff7be2bab..5a979d36e81 100644 --- a/llvm/lib/MC/WasmObjectWriter.cpp +++ b/llvm/lib/MC/WasmObjectWriter.cpp @@ -270,9 +270,9 @@ private: Globals.clear(); DataSegments.clear(); SectionFunctions.clear(); - MCObjectWriter::reset(); NumFunctionImports = 0; NumGlobalImports = 0; + MCObjectWriter::reset(); } void writeHeader(const MCAssembler &Asm); diff --git a/llvm/test/MC/WebAssembly/compile-twice.ll b/llvm/test/MC/WebAssembly/compile-twice.ll new file mode 100644 index 00000000000..5fc3a04eacc --- /dev/null +++ b/llvm/test/MC/WebAssembly/compile-twice.ll @@ -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} |