[llvm-branch-commits] [llvm] 45d8a78 - Simplify append to module inline asm string in IRLinker::run()

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 2 06:01:18 PST 2020


Author: Hans Wennborg
Date: 2020-12-02T14:56:43+01:00
New Revision: 45d8a7843253ec68367c26114a2aa6bff2a7a4bb

URL: https://github.com/llvm/llvm-project/commit/45d8a7843253ec68367c26114a2aa6bff2a7a4bb
DIFF: https://github.com/llvm/llvm-project/commit/45d8a7843253ec68367c26114a2aa6bff2a7a4bb.diff

LOG: Simplify append to module inline asm string in IRLinker::run()

This also removes the empty extra "module asm" that would be created,
and updates the test to reflect that while making it more explicit.

Broken out from https://reviews.llvm.org/D92335

Added: 
    

Modified: 
    llvm/lib/Linker/IRMover.cpp
    llvm/test/Linker/link-arm-and-thumb-module-inline-asm.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index d55c53eef23d..5a67266a9f46 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1440,13 +1440,8 @@ Error IRLinker::run() {
 
   // Append the module inline asm string.
   if (!IsPerformingImport && !SrcM->getModuleInlineAsm().empty()) {
-    std::string SrcModuleInlineAsm = adjustInlineAsm(SrcM->getModuleInlineAsm(),
-                                                     SrcTriple);
-    if (DstM.getModuleInlineAsm().empty())
-      DstM.setModuleInlineAsm(SrcModuleInlineAsm);
-    else
-      DstM.setModuleInlineAsm(DstM.getModuleInlineAsm() + "\n" +
-                              SrcModuleInlineAsm);
+    DstM.appendModuleInlineAsm(adjustInlineAsm(SrcM->getModuleInlineAsm(),
+                                               SrcTriple));
   }
 
   // Loop over all of the linked values to compute type mappings.

diff  --git a/llvm/test/Linker/link-arm-and-thumb-module-inline-asm.ll b/llvm/test/Linker/link-arm-and-thumb-module-inline-asm.ll
index 13779f37ffa0..5e12a8c88d90 100644
--- a/llvm/test/Linker/link-arm-and-thumb-module-inline-asm.ll
+++ b/llvm/test/Linker/link-arm-and-thumb-module-inline-asm.ll
@@ -9,12 +9,11 @@ target triple = "armv7-linux-gnueabihf"
 
 module asm "add r1, r2, r2"
 
-; CHECK: .text
-; CHECK-NEXT: .balign 4
-; CHECK-NEXT: .arm
-; CHECK-NEXT: add r1, r2, r2
-; CHECK-NEXT: module asm
-; CHECK-NEXT: .text
-; CHECK-NEXT: .balign 2
-; CHECK-NEXT: .thumb
-; CHECK-NEXT: orn r1, r2, r2
+; CHECK:      module asm ".text"
+; CHECK-NEXT: module asm ".balign 4"
+; CHECK-NEXT: module asm ".arm"
+; CHECK-NEXT: module asm "add r1, r2, r2"
+; CHECK-NEXT: module asm ".text"
+; CHECK-NEXT: module asm ".balign 2"
+; CHECK-NEXT: module asm ".thumb"
+; CHECK-NEXT: module asm "orn r1, r2, r2"


        


More information about the llvm-branch-commits mailing list