[PATCH] D42944: ThinLTOBitcodeWriter: Do not include module-level inline asm in the merged module.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 19:00:23 PST 2018


pcc created this revision.
pcc added a reviewer: tejohnson.
Herald added subscribers: hiraditya, eraman, inglorion, mehdi_amini.

If the inline asm provides the definition of a symbol, this can result
in duplicate symbol errors.


https://reviews.llvm.org/D42944

Files:
  llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
  llvm/test/Transforms/ThinLTOBitcodeWriter/module-asm.ll


Index: llvm/test/Transforms/ThinLTOBitcodeWriter/module-asm.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/ThinLTOBitcodeWriter/module-asm.ll
@@ -0,0 +1,12 @@
+; RUN: opt -thinlto-bc -o %t %s
+; RUN: llvm-modextract -b -n 0 -o - %t | llvm-dis | FileCheck --check-prefix=M0 %s
+; RUN: llvm-modextract -b -n 1 -o - %t | llvm-dis | FileCheck --check-prefix=M1 %s
+
+target triple = "x86_64-unknown-linux-gnu"
+
+ at g = constant i32 0, !type !0
+!0 = !{i32 0, !"typeid"}
+
+; M0: module asm "ret"
+; M1-NOT: module asm
+module asm "ret"
Index: llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
===================================================================
--- llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
+++ llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
@@ -298,6 +298,7 @@
         return false;
       }));
   StripDebugInfo(*MergedM);
+  MergedM->setModuleInlineAsm("");
 
   for (Function &F : *MergedM)
     if (!F.isDeclaration()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42944.132929.patch
Type: text/x-patch
Size: 1009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180206/9c5ce3dc/attachment.bin>


More information about the llvm-commits mailing list