74 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt < %s -mtriple=x86_64-unknown-unknown -S -passes=inline | FileCheck %s3;; Test that when we inline an invoked function, when we replace an inlined4;; "resume" instruction with a branch to the landing pad block, we also transfer5;; the resume's source location to the branch.6 7define void @widget() personality ptr null !dbg !11 {8; CHECK-LABEL: define void @widget(9; CHECK-SAME: ) personality ptr null !dbg [[DBG4:![0-9]+]] {10; CHECK-NEXT: [[BAZ_EXIT:.*]]:11; CHECK-NEXT: br label %[[BB2_BODY:.*]], !dbg [[DBG7:![0-9]+]]12; CHECK: [[BAZ_EXIT1:.*:]]13; CHECK-NEXT: br label %[[BB1:.*]]14; CHECK: [[BB1]]:15; CHECK-NEXT: ret void16; CHECK: [[BB2:.*]]:17; CHECK-NEXT: [[LANDINGPAD:%.*]] = landingpad { ptr, i32 }18; CHECK-NEXT: cleanup19; CHECK-NEXT: br label %[[BB2_BODY]]20; CHECK: [[BB2_BODY]]:21; CHECK-NEXT: [[EH_LPAD_BODY:%.*]] = phi { ptr, i32 } [ [[LANDINGPAD]], %[[BB2]] ], [ zeroinitializer, %[[BAZ_EXIT]] ]22; CHECK-NEXT: br label %[[BB1]]23;24bb:25 %invoke = invoke i32 @baz(ptr null, ptr null)26 to label %bb1 unwind label %bb2, !dbg !427 28bb1: ; preds = %bb2, %bb29 ret void30 31bb2: ; preds = %bb32 %landingpad = landingpad { ptr, i32 }33 cleanup34 br label %bb135}36 37define i32 @baz(ptr %arg, ptr %arg1) personality ptr null !dbg !14 {38; CHECK-LABEL: define i32 @baz(39; CHECK-SAME: ptr [[ARG:%.*]], ptr [[ARG1:%.*]]) personality ptr null !dbg [[DBG8:![0-9]+]] {40; CHECK-NEXT: [[BB:.*:]]41; CHECK-NEXT: resume { ptr, i32 } zeroinitializer, !dbg [[DBG10:![0-9]+]]42;43bb:44 resume { ptr, i32 } zeroinitializer, !dbg !1545}46 47!llvm.dbg.cu = !{!0}48!llvm.module.flags = !{!3}49 50!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)51!1 = !DIFile(filename: "inline-landing-pad.cpp", directory: "/tmp")52!2 = !{}53!3 = !{i32 2, !"Debug Info Version", i32 3}54!4 = !DILocation(line: 99, column: 17, scope: !11)55!6 = !DIFile(filename: "inline-landing-pad.cpp", directory: "/tmp")56!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)57!12 = distinct !DISubroutineType(types: !13)58!13 = !{null}59!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)60!15 = !DILocation(line: 9, column: 7, scope: !14)61!16 = distinct !DISubroutineType(types: !13)62;.63; 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)64; CHECK: [[META1]] = !DIFile(filename: "inline-landing-pad.cpp", directory: {{.*}})65; CHECK: [[META2]] = !{}66; 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]])67; CHECK: [[META5]] = distinct !DISubroutineType(types: [[META6:![0-9]+]])68; CHECK: [[META6]] = !{null}69; CHECK: [[DBG7]] = !DILocation(line: 9, column: 7, scope: [[DBG8]], inlinedAt: [[META9:![0-9]+]])70; 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]])71; CHECK: [[META9]] = distinct !DILocation(line: 99, column: 17, scope: [[DBG4]])72; CHECK: [[DBG10]] = !DILocation(line: 9, column: 7, scope: [[DBG8]])73;.74