43 lines · plain
1// RUN: mlir-translate -test-to-llvmir -split-input-file %s | FileCheck %s2 3module {4 "test.symbol"() <{sym_name = "foo"}> : () -> ()5}6 7// CHECK-NOT: @sym_from_attr8// CHECK: @foo = external global i329// CHECK-NOT: @sym_from_attr10 11// -----12 13// Make sure that the module attribute is processed before its body, so that the14// `test.symbol` that is created as a result of the `test.discardable_mod_attr`15// attribute is later picked up and translated to LLVM IR.16module attributes {test.discardable_mod_attr = true} {}17 18// CHECK: @sym_from_attr = external global i3219 20// -----21 22// CHECK-LABEL: @dialect_attr_translation23llvm.func @dialect_attr_translation() {24 // CHECK: ret void, !annotation ![[MD_ID:.+]]25 llvm.return {test.add_annotation}26}27// CHECK: ![[MD_ID]] = !{!"annotation_from_test"}28 29// -----30 31// CHECK-LABEL: @dialect_attr_translation_multi32llvm.func @dialect_attr_translation_multi(%a: i64, %b: i64, %c: i64) -> i64 {33 // CHECK: add {{.*}}, !annotation ![[MD_ID_ADD:.+]]34 // CHECK: mul {{.*}}, !annotation ![[MD_ID_MUL:.+]]35 // CHECK: ret {{.*}}, !annotation ![[MD_ID_RET:.+]]36 %ab = llvm.add %a, %b {test.add_annotation = "add"} : i6437 %r = llvm.mul %ab, %c {test.add_annotation = "mul"} : i6438 llvm.return {test.add_annotation = "ret"} %r : i6439}40// CHECK-DAG: ![[MD_ID_ADD]] = !{!"annotation_from_test: add"}41// CHECK-DAG: ![[MD_ID_MUL]] = !{!"annotation_from_test: mul"}42// CHECK-DAG: ![[MD_ID_RET]] = !{!"annotation_from_test: ret"}43