|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: opt < %s -p=simplifycfg -S | FileCheck %s |
| 3 | + |
| 4 | +;; Test that when we replace the invoke of @baz with a call and branch to the |
| 5 | +;; invoke destination, we propagate the source location of the invoke to both |
| 6 | +;; the call and the branch. |
| 7 | + |
| 8 | +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" |
| 9 | +target triple = "x86_64-unknown-linux-gnu" |
| 10 | + |
| 11 | +define void @widget(i1 %arg) personality ptr null !dbg !5 { |
| 12 | +; CHECK-LABEL: define void @widget( |
| 13 | +; CHECK-SAME: i1 [[ARG:%.*]]) personality ptr null !dbg [[DBG5:![0-9]+]] { |
| 14 | +; CHECK-NEXT: [[BB:.*:]] |
| 15 | +; CHECK-NEXT: br i1 [[ARG]], label %[[BB2:.*]], label %[[BB1:.*]] |
| 16 | +; CHECK: [[BB1]]: |
| 17 | +; CHECK-NEXT: call void @baz(ptr null) #[[ATTR0:[0-9]+]], !dbg [[DBG8:![0-9]+]] |
| 18 | +; CHECK-NEXT: br label %[[BB2]], !dbg [[DBG8]] |
| 19 | +; CHECK: [[BB2]]: |
| 20 | +; CHECK-NEXT: ret void |
| 21 | +; |
| 22 | +bb: |
| 23 | + br i1 %arg, label %bb2, label %bb1 |
| 24 | + |
| 25 | +bb1: ; preds = %bb |
| 26 | + invoke void @baz(ptr null) |
| 27 | + to label %bb2 unwind label %bb3, !dbg !8 |
| 28 | + |
| 29 | +bb2: ; preds = %bb1, %bb |
| 30 | + ret void |
| 31 | + |
| 32 | +bb3: ; preds = %bb1 |
| 33 | + %landingpad = landingpad { ptr, i32 } |
| 34 | + cleanup |
| 35 | + store i1 false, ptr null, align 1 |
| 36 | + ret void |
| 37 | +} |
| 38 | + |
| 39 | +declare void @baz(ptr) |
| 40 | + |
| 41 | +!llvm.dbg.cu = !{!0} |
| 42 | +!llvm.debugify = !{!2, !3} |
| 43 | +!llvm.module.flags = !{!4} |
| 44 | + |
| 45 | +!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug) |
| 46 | +!1 = !DIFile(filename: "debugloc-invoke-to-call-br.ll", directory: "/") |
| 47 | +!2 = !{i32 6} |
| 48 | +!3 = !{i32 0} |
| 49 | +!4 = !{i32 2, !"Debug Info Version", i32 3} |
| 50 | +!5 = distinct !DISubprogram(name: "widget", linkageName: "widget", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0) |
| 51 | +!6 = !DISubroutineType(types: !7) |
| 52 | +!7 = !{} |
| 53 | +!8 = !DILocation(line: 1, column: 1, scope: !5) |
| 54 | +;. |
| 55 | +; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C, file: [[META1:![0-9]+]], producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug) |
| 56 | +; CHECK: [[META1]] = !DIFile(filename: "debugloc-invoke-to-call-br.ll", directory: {{.*}}) |
| 57 | +; CHECK: [[DBG5]] = distinct !DISubprogram(name: "widget", linkageName: "widget", scope: null, file: [[META1]], line: 1, type: [[META6:![0-9]+]], scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]]) |
| 58 | +; CHECK: [[META6]] = !DISubroutineType(types: [[META7:![0-9]+]]) |
| 59 | +; CHECK: [[META7]] = !{} |
| 60 | +; CHECK: [[DBG8]] = !DILocation(line: 1, column: 1, scope: [[DBG5]]) |
| 61 | +;. |
0 commit comments