Skip to content

Incorrect translation for PrettyDialectType. #44

@KimythAnly

Description

@KimythAnly

Hi, I noticed that in the following example, the #llvm.linkage (pretty dialect attribute) is being parsed as a pretty dialect type (!llvm.linkage). I'm just curious— is this the expected behavior? Thanks!

This MLIR is copied from #42.

module {
  func.func @test(%arg0: memref<?xi32>, %arg1: memref<?xi32>) attributes {llvm.linkage = #llvm.linkage<external>} {
    %c2_i32 = arith.constant 2 : i32
    %c0 = arith.constant 0 : index
    %0 = memref.load %arg1 : memref<?xi32>
    %1 = arith.addi %0, %c2_i32 : i32
    %c0_0 = arith.constant 0 : index
    memref.store %1, %arg0 : memref<?xi32>
    return
  }
}

Reproducible code

import mlir

m = """module {
  func.func @test(%arg0: memref<?xi32>, %arg1: memref<?xi32>) attributes {llvm.linkage = #llvm.linkage<external>} {
    %c2_i32 = arith.constant 2 : i32
    %c0 = arith.constant 0 : index
    %0 = memref.load %arg1 : memref<?xi32>
    %1 = arith.addi %0, %c2_i32 : i32
    %c0_0 = arith.constant 0 : index
    memref.store %1, %arg0 : memref<?xi32>
    return
  }
}"""

parser = mlir.Parser()
print(parser.parse(m).pretty())

The output:

module {
  func.func @test(%arg0: memref<?xi32>, %arg1: memref<?xi32>) attributes {llvm.linkage = !llvm.linkage<external>} {
    %c2_i32 = arith.constant 2 : i32
    %c0 = arith.constant 0 : index
    %0 = memref.load %arg1 : memref<?xi32>
    %1 = arith.addi %0, %c2_i32 : i32
    %c0_0 = arith.constant 0 : index
    memref.store %1, %arg0 : memref<?xi32>
    return
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions