Issue |
135709
|
Summary |
[MLIR][LLVM] Failed to round-trip inlined asm
|
Labels |
mlir
|
Assignees |
|
Reporter |
Kuree
|
Godbolt: https://godbolt.org/z/7YnW8KGvY
Error message:
Operand for indirect constraint must have elementtype attribute
call void asm sideeffect "movl $$3,$0", "=*imr,~{memory},~{dirflag},~{fpsr},~{flags}"(ptr %2)
Input:
```llvm
; ModuleID = './bug.c'
source_filename = "./bug.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @main() #0 {
entry:
%retval = alloca i32, align 4
%x = alloca i32, align 4
store i32 0, ptr %retval, align 4
call void asm sideeffect "movl $$3,$0", "=*imr,~{memory},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %x) #1, !srcloc !6
ret i32 0
}
attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.ident = !{!5}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{i32 7, !"frame-pointer", i32 2}
!5 = !{!"clang version 21.0.0git (https://github.com/llvm/llvm-project 9fb792496687df1136d78e828cffe4f7f04a7043)"}
!6 = !{i64 44}
```
How to reproduce:
```shell
mlir-translate --import-llvm inputl.ll | mlir-translate --mlir-to-llvmir
```
The input is a legal llvm file. Compile to x86:
```shell
clang input.ll -o test
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs