1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

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
This commit is contained in:
Hans Wennborg 2020-12-02 14:45:49 +01:00
parent a87022c5f8
commit 3bed264463
2 changed files with 10 additions and 16 deletions

View File

@ -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.

View File

@ -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"