[PATCH] D62923: [WebAssembly] Improve lto/comdat.ll test. NFC.

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 11:49:50 PDT 2019


sbc100 created this revision.
Herald added subscribers: llvm-commits, dexonsmith, steven_wu, sunfish, aheejin, jgravelle-google, inglorion, mehdi_amini, dschuff.
Herald added a project: LLVM.
sbc100 added a reviewer: ruiu.

We were not previously testing the comdat exclusion with bitcode
object parsing because we were linking two copied of the .bc file and
the `linkonce_odr` linkage type was removing the duplicate `_start`
function during LTO.

Now we link an bitcode and non-bitcode version both of which contains
a copy of _start.  And we link them in both orders, which means this
test will fail if comdat exclusion is not working correctly in the
parsing of the bitcode file.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62923

Files:
  lld/test/wasm/lto/comdat.ll
  llvm/docs/LangRef.rst


Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -862,7 +862,8 @@
 Comdats
 -------
 
-Comdat IR provides access to COFF and ELF object file COMDAT functionality.
+Comdat IR provides access to COFF, WebAssembly and ELF object file COMDAT
+functionality.
 
 Comdats have a name which represents the COMDAT key. All global objects that
 specify this key will only end up in the final object file if the linker chooses
Index: lld/test/wasm/lto/comdat.ll
===================================================================
--- lld/test/wasm/lto/comdat.ll
+++ lld/test/wasm/lto/comdat.ll
@@ -1,15 +1,17 @@
 ; Verify that comdat symbols can be defined in LTO objects.  We had a
 ; regression where the comdat handling code was causing symbol in the lto object
 ; to be ignored.
-; RUN: llvm-as %s -o %t.o
-; RUN: wasm-ld %t.o %t.o -o %t.wasm
+; RUN: llvm-as %s -o %t.bc
+; RUN: llc -filetype=obj %s -o %t.o
+; RUN: wasm-ld %t.bc %t.o -o %t.wasm
+; RUN: wasm-ld %t.o %t.bc -o %t.wasm
 
 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
 target triple = "wasm32-unknown-unknown"
 
 $foo = comdat any
 
-define linkonce_odr void @_start() comdat($foo) {
+define void @_start() comdat($foo) {
 entry:
   ret void
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62923.203216.patch
Type: text/x-patch
Size: 1315 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190605/3b0f2d6c/attachment.bin>


More information about the llvm-commits mailing list