|
1 |
| -; RUN: mlir-translate -import-llvm %s | FileCheck %s |
| 1 | +; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s |
2 | 2 |
|
3 | 3 | @_ZTIi = external dso_local constant ptr
|
4 | 4 | @_ZTIii= external dso_local constant ptr
|
@@ -148,3 +148,45 @@ exit:
|
148 | 148 | ; CHECK: llvm.return
|
149 | 149 | ret void
|
150 | 150 | }
|
| 151 | + |
| 152 | +; // ----- |
| 153 | + |
| 154 | +declare i32 @__gxx_personality_v0(...) |
| 155 | +declare void @foo(ptr) |
| 156 | + |
| 157 | +; CHECK-LABEL: @invokeLandingpad |
| 158 | +define i32 @invokeLandingpad(ptr %addr) personality ptr @__gxx_personality_v0 { |
| 159 | +entry: |
| 160 | + %1 = alloca i8 |
| 161 | + %zzz = load i32, ptr %addr, align 4 |
| 162 | + invoke void @foo(ptr %1) to label %bb1 unwind label %bb2 |
| 163 | + |
| 164 | +bb1: |
| 165 | + %yyy = load i32, ptr %addr, align 4 |
| 166 | + invoke void @foo(ptr %1) to label %bb3 unwind label %bb2 |
| 167 | + |
| 168 | +; CHECK: ^bb{{.*}}(%[[ARG:.*]]: i32): |
| 169 | +bb2: |
| 170 | + %phi_var = phi i32 [ %zzz, %entry ], [ %yyy, %bb1 ], !dbg !5 |
| 171 | + ; CHECK: llvm.landingpad cleanup : !llvm.struct<(ptr, i32)> |
| 172 | + ; CHECK-NEXT: llvm.intr.dbg.value #di_local_variable #llvm.di_expression<[DW_OP_LLVM_fragment(64, 64)]> = %[[ARG]] : i32 |
| 173 | + %3 = landingpad { ptr, i32 } cleanup, !dbg !5 |
| 174 | + #dbg_value(i32 %phi_var, !8, !DIExpression(DW_OP_LLVM_fragment, 64, 64), !7) |
| 175 | + br label %bb3 |
| 176 | + |
| 177 | +bb3: |
| 178 | + ; CHECK: llvm.return %{{[0-9]+}} : i32 |
| 179 | + ret i32 1 |
| 180 | +} |
| 181 | + |
| 182 | +!llvm.dbg.cu = !{!1} |
| 183 | +!llvm.module.flags = !{!0} |
| 184 | +!0 = !{i32 2, !"Debug Info Version", i32 3} |
| 185 | +!1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2) |
| 186 | +!2 = !DIFile(filename: "landingpad.ll", directory: "/") |
| 187 | +!3 = distinct !DISubprogram(name: "instruction_loc", scope: !2, file: !2, spFlags: DISPFlagDefinition, unit: !1) |
| 188 | +!4 = distinct !DISubprogram(name: "callee", scope: !2, file: !2, spFlags: DISPFlagDefinition, unit: !1) |
| 189 | +!5 = !DILocation(line: 1, column: 2, scope: !3) |
| 190 | +!6 = !DILocation(line: 2, column: 2, scope: !3) |
| 191 | +!7 = !DILocation(line: 7, column: 4, scope: !4, inlinedAt: !6) |
| 192 | +!8 = !DILocalVariable(scope: !4, name: "size") |
0 commit comments