xref: /llvm-project/mlir/test/Dialect/LLVMIR/invalid-call-location.mlir (revision b3037ae1fc6d26459e37f813757ad30872eb2eee)
1// RUN: not mlir-opt %s -split-input-file 2>&1 | FileCheck %s
2
3// This test is in a separate file because the location tracking of verify
4// diagnostics does not work for unknown locations.
5
6#di_file = #llvm.di_file<"file.cpp" in "/folder/">
7#di_compile_unit = #llvm.di_compile_unit<
8  id = distinct[0]<>, sourceLanguage = DW_LANG_C_plus_plus_14,
9  file = #di_file, isOptimized = true, emissionKind = Full
10>
11#di_subprogram = #llvm.di_subprogram<
12  compileUnit = #di_compile_unit, scope = #di_file,
13  name = "missing_debug_loc", file = #di_file,
14  subprogramFlags = "Definition|Optimized"
15>
16#di_subprogram1 = #llvm.di_subprogram<
17  compileUnit = #di_compile_unit, scope = #di_file,
18  name = "invalid_call_debug_locs", file = #di_file,
19  subprogramFlags = "Definition|Optimized"
20>
21#loc = loc(unknown)
22#loc1 = loc("file.cpp":24:0)
23#loc2 = loc(fused<#di_subprogram>[#loc1])
24#loc3 = loc("file.cpp":42:0)
25#loc4 = loc(fused<#di_subprogram1>[#loc3])
26
27llvm.func @missing_debug_loc() {
28  llvm.return
29} loc(#loc2)
30
31llvm.func @invalid_call_debug_locs() {
32// CHECK: <unknown>:0: error: inlinable function call in a function with a DISubprogram location must have a debug location
33  llvm.call @missing_debug_loc() : () -> () loc(#loc)
34  llvm.return
35} loc(#loc4)
36