This commit improves the debug information for `alloca` and `memcpy` operations generated by the LLVM dialect inlining interface. When inlining by value parameters, the inliner creates `alloca` and `memcpy` operations. This revision sets the location of these created operations to the respective argument locations instead of the function location. This change enables users to better identify the source code location of the copied variables.
22 lines
695 B
MLIR
22 lines
695 B
MLIR
// RUN: mlir-opt %s -inline -mlir-print-debuginfo | FileCheck %s
|
|
|
|
llvm.func @foo() -> !llvm.ptr
|
|
|
|
llvm.func @with_byval_arg(%ptr : !llvm.ptr { llvm.byval = f64 }) {
|
|
llvm.return
|
|
}
|
|
|
|
// CHECK-LABEL: llvm.func @test_byval
|
|
llvm.func @test_byval() {
|
|
// CHECK: %[[COPY:.+]] = llvm.alloca %{{.+}} x f64
|
|
// CHECK-SAME: loc(#[[LOC:.+]])
|
|
// CHECK: %[[ORIG:.+]] = llvm.call @foo() : () -> !llvm.ptr loc(#[[LOC]])
|
|
%0 = llvm.call @foo() : () -> !llvm.ptr loc("inlining-debuginfo.mlir":14:2)
|
|
// CHECK: "llvm.intr.memcpy"(%[[COPY]], %[[ORIG]]
|
|
// CHECK-SAME: loc(#[[LOC]])
|
|
llvm.call @with_byval_arg(%0) : (!llvm.ptr) -> ()
|
|
llvm.return
|
|
}
|
|
|
|
// CHECK: #[[LOC]] = loc("inlining-debuginfo.mlir":14:2)
|