; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 ; RUN: opt < %s -mtriple=x86_64-unknown-unknown -S -passes=inline | FileCheck %s ;; Test that when we inline an invoked function, when we replace an inlined ;; "resume" instruction with a branch to the landing pad block, we also transfer ;; the resume's source location to the branch. define void @widget() personality ptr null !dbg !11 { ; CHECK-LABEL: define void @widget( ; CHECK-SAME: ) personality ptr null !dbg [[DBG4:![0-9]+]] { ; CHECK-NEXT: [[BAZ_EXIT:.*]]: ; CHECK-NEXT: br label %[[BB2_BODY:.*]], !dbg [[DBG7:![0-9]+]] ; CHECK: [[BAZ_EXIT1:.*:]] ; CHECK-NEXT: br label %[[BB1:.*]] ; CHECK: [[BB1]]: ; CHECK-NEXT: ret void ; CHECK: [[BB2:.*]]: ; CHECK-NEXT: [[LANDINGPAD:%.*]] = landingpad { ptr, i32 } ; CHECK-NEXT: cleanup ; CHECK-NEXT: br label %[[BB2_BODY]] ; CHECK: [[BB2_BODY]]: ; CHECK-NEXT: [[EH_LPAD_BODY:%.*]] = phi { ptr, i32 } [ [[LANDINGPAD]], %[[BB2]] ], [ zeroinitializer, %[[BAZ_EXIT]] ] ; CHECK-NEXT: br label %[[BB1]] ; bb: %invoke = invoke i32 @baz(ptr null, ptr null) to label %bb1 unwind label %bb2, !dbg !4 bb1: ; preds = %bb2, %bb ret void bb2: ; preds = %bb %landingpad = landingpad { ptr, i32 } cleanup br label %bb1 } define i32 @baz(ptr %arg, ptr %arg1) personality ptr null !dbg !14 { ; CHECK-LABEL: define i32 @baz( ; CHECK-SAME: ptr [[ARG:%.*]], ptr [[ARG1:%.*]]) personality ptr null !dbg [[DBG8:![0-9]+]] { ; CHECK-NEXT: [[BB:.*:]] ; CHECK-NEXT: resume { ptr, i32 } zeroinitializer, !dbg [[DBG10:![0-9]+]] ; bb: resume { ptr, i32 } zeroinitializer, !dbg !15 } !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!3} !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 20.0.0git", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: !2, globals: !2, imports: !2, splitDebugInlining: false, nameTableKind: None) !1 = !DIFile(filename: "inline-landing-pad.cpp", directory: "/tmp") !2 = !{} !3 = !{i32 2, !"Debug Info Version", i32 3} !4 = !DILocation(line: 99, column: 17, scope: !11) !6 = !DIFile(filename: "inline-landing-pad.cpp", directory: "/tmp") !11 = distinct !DISubprogram(name: "widget", linkageName: "widget", scope: !6, file: !6, line: 87, type: !12, scopeLine: 88, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) !12 = distinct !DISubroutineType(types: !13) !13 = !{null} !14 = distinct !DISubprogram(name: "baz", linkageName: "baz", scope: !6, file: !6, line: 7, type: !12, scopeLine: 8, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) !15 = !DILocation(line: 9, column: 7, scope: !14) !16 = distinct !DISubroutineType(types: !13) ;. ; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: [[META1:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: [[META2:![0-9]+]], globals: [[META2]], imports: [[META2]], splitDebugInlining: false, nameTableKind: None) ; CHECK: [[META1]] = !DIFile(filename: "inline-landing-pad.cpp", directory: {{.*}}) ; CHECK: [[META2]] = !{} ; CHECK: [[DBG4]] = distinct !DISubprogram(name: "widget", linkageName: "widget", scope: [[META1]], file: [[META1]], line: 87, type: [[META5:![0-9]+]], scopeLine: 88, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META2]]) ; CHECK: [[META5]] = distinct !DISubroutineType(types: [[META6:![0-9]+]]) ; CHECK: [[META6]] = !{null} ; CHECK: [[DBG7]] = !DILocation(line: 9, column: 7, scope: [[DBG8]], inlinedAt: [[META9:![0-9]+]]) ; CHECK: [[DBG8]] = distinct !DISubprogram(name: "baz", linkageName: "baz", scope: [[META1]], file: [[META1]], line: 7, type: [[META5]], scopeLine: 8, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META2]]) ; CHECK: [[META9]] = distinct !DILocation(line: 99, column: 17, scope: [[DBG4]]) ; CHECK: [[DBG10]] = !DILocation(line: 9, column: 7, scope: [[DBG8]]) ;.