diff options
author | Sam Clegg <sbc@chromium.org> | 2018-05-30 02:57:20 +0000 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2018-05-30 02:57:20 +0000 |
commit | 105bdc25573288b9abf2d5d81313ec549a7e8af7 (patch) | |
tree | c480fc61a7d9f20e877c7289de959fb7fa1d584a | |
parent | 71fd27043ee0c8e1b9a1a71aeab7d5629a7b29f1 (diff) | |
download | bcm5719-llvm-105bdc25573288b9abf2d5d81313ec549a7e8af7.tar.gz bcm5719-llvm-105bdc25573288b9abf2d5d81313ec549a7e8af7.zip |
[WebAssembly] MC: Add compile-twice test and fix corresponding bug
Differential Revision: https://reviews.llvm.org/D47398
llvm-svn: 333494
-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} |