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

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 19:29:18 PST 2018


Author: pcc
Date: Mon Feb  5 19:29:18 2018
New Revision: 324313

URL: http://llvm.org/viewvc/llvm-project?rev=324313&view=rev
Log:
ThinLTOBitcodeWriter: Do not include module-level inline asm in the merged module.

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

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

Added:
    llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/module-asm.ll
Modified:
    llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp

Modified: llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp?rev=324313&r1=324312&r2=324313&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp Mon Feb  5 19:29:18 2018
@@ -298,6 +298,7 @@ void splitAndWriteThinLTOBitcode(
         return false;
       }));
   StripDebugInfo(*MergedM);
+  MergedM->setModuleInlineAsm("");
 
   for (Function &F : *MergedM)
     if (!F.isDeclaration()) {

Added: llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/module-asm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/module-asm.ll?rev=324313&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/module-asm.ll (added)
+++ llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/module-asm.ll Mon Feb  5 19:29:18 2018
@@ -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"




More information about the llvm-commits mailing list