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

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Tue May 29 19:57:20 PDT 2018


Author: sbc
Date: Tue May 29 19:57:20 2018
New Revision: 333494

URL: http://llvm.org/viewvc/llvm-project?rev=333494&view=rev
Log:
[WebAssembly] MC: Add compile-twice test and fix corresponding bug

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

Added:
    llvm/trunk/test/MC/WebAssembly/compile-twice.ll
Modified:
    llvm/trunk/lib/MC/MCContext.cpp
    llvm/trunk/lib/MC/WasmObjectWriter.cpp

Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=333494&r1=333493&r2=333494&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Tue May 29 19:57:20 2018
@@ -105,6 +105,7 @@ void MCContext::reset() {
   MachOUniquingMap.clear();
   ELFUniquingMap.clear();
   COFFUniquingMap.clear();
+  WasmUniquingMap.clear();
 
   NextID.clear();
   AllowTemporaryLabels = true;

Modified: llvm/trunk/lib/MC/WasmObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WasmObjectWriter.cpp?rev=333494&r1=333493&r2=333494&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WasmObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WasmObjectWriter.cpp Tue May 29 19:57:20 2018
@@ -270,9 +270,9 @@ private:
     Globals.clear();
     DataSegments.clear();
     SectionFunctions.clear();
-    MCObjectWriter::reset();
     NumFunctionImports = 0;
     NumGlobalImports = 0;
+    MCObjectWriter::reset();
   }
 
   void writeHeader(const MCAssembler &Asm);

Added: llvm/trunk/test/MC/WebAssembly/compile-twice.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/compile-twice.ll?rev=333494&view=auto
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/compile-twice.ll (added)
+++ llvm/trunk/test/MC/WebAssembly/compile-twice.ll Tue May 29 19:57:20 2018
@@ -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}
+
+ at 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}




More information about the llvm-commits mailing list