Skip to content

Commit bc7cf6c

Browse files
committed
use ArrayAttr
1 parent dd8b762 commit bc7cf6c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

mlir/lib/Target/LLVMIR/ModuleTranslation.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,8 +2277,11 @@ prepareLLVMModule(Operation *m, llvm::LLVMContext &llvmContext,
22772277
llvm::Triple(cast<StringAttr>(targetTripleAttr).getValue()));
22782278

22792279
if (auto asmAttr =
2280-
m->getDiscardableAttr(LLVM::LLVMDialect::getModuleLevelAsmAttrName()))
2281-
llvmModule->setModuleInlineAsm(cast<StringAttr>(asmAttr).getValue());
2280+
m->getDiscardableAttr(LLVM::LLVMDialect::getModuleLevelAsmAttrName())) {
2281+
auto arr = cast<ArrayAttr>(asmAttr);
2282+
for (unsigned i = 0; i < arr.size(); ++i)
2283+
llvmModule->appendModuleInlineAsm(cast<StringAttr>(arr[i]).getValue());
2284+
}
22822285

22832286
return llvmModule;
22842287
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s
22

3-
module attributes {llvm.module_asm = "foo"} {}
3+
module attributes {llvm.module_asm = ["foo", "bar"]} {}
44

5-
// CHECK: module asm "foo"
5+
// CHECK: module asm "foo"
6+
// CHECK: module asm "bar"

0 commit comments

Comments
 (0)