93 lines · plain
1; RUN: llc %s -stop-before=finalize-isel -o -\2; RUN: -experimental-debug-variable-locations \3; RUN: | FileCheck %s4;5; Test that instruction referencing variable locations can cope with exception6; landing pads. Variable locations can be derived from the ABI-defined arguments7; to landing-pad blocks, which should be treated much like argument locations.8; This gloriously simple piece of C++:9;10; void a() try { a(); } catch (int *&) { }11;12; Produces the code below. A nameless variable is attached to the landing-pad13; record %0 (via %3), which salvages back to the entry to the landing pad. We14; should place a DBG_PHI at that point. Instead of crashing.15;16; CHECK-LABEL: bb.1.lpad (landing-pad):17; CHECK: DBG_PHI $rax, 118; CHECK-NEXT: EH_LABEL19 20target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"21target triple = "x86_64-unknown-linux-gnu"22 23@_ZTIPi = external dso_local constant ptr24 25define dso_local void @_Z1av() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 !dbg !8 {26entry:27 invoke void @_Z1av()28 to label %try.cont unwind label %lpad, !dbg !1729 30lpad: ; preds = %entry31 %0 = landingpad { ptr, i32 }32 catch ptr @_ZTIPi, !dbg !1933 %1 = extractvalue { ptr, i32 } %0, 1, !dbg !1934 %2 = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIPi) #3, !dbg !2035 %matches = icmp eq i32 %1, %2, !dbg !2036 br i1 %matches, label %catch, label %eh.resume, !dbg !2037 38catch: ; preds = %lpad39 %3 = extractvalue { ptr, i32 } %0, 0, !dbg !1940 %4 = tail call ptr @__cxa_begin_catch(ptr %3) #3, !dbg !2041 call void @llvm.dbg.value(metadata ptr %3, metadata !13, metadata !DIExpression(DW_OP_plus_uconst, 32, DW_OP_stack_value)), !dbg !2142 tail call void @__cxa_end_catch() #3, !dbg !2243 br label %try.cont, !dbg !2244 45try.cont: ; preds = %entry, %catch46 ret void, !dbg !2447 48eh.resume: ; preds = %lpad49 resume { ptr, i32 } %0, !dbg !2050}51 52declare dso_local i32 @__gxx_personality_v0(...)53 54; Function Attrs: nofree nosync nounwind readnone55declare i32 @llvm.eh.typeid.for(ptr) #156 57declare dso_local ptr @__cxa_begin_catch(ptr) local_unnamed_addr58 59declare dso_local void @__cxa_end_catch() local_unnamed_addr60 61; Function Attrs: mustprogress nofree nosync nounwind readnone speculatable willreturn62declare void @llvm.dbg.value(metadata, metadata, metadata) #263 64!llvm.dbg.cu = !{!0}65!llvm.module.flags = !{!3, !4, !5, !6}66!llvm.ident = !{!7}67 68!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)69!1 = !DIFile(filename: "test.cpp", directory: ".")70!2 = !{}71!3 = !{i32 7, !"Dwarf Version", i32 4}72!4 = !{i32 2, !"Debug Info Version", i32 3}73!5 = !{i32 1, !"wchar_size", i32 4}74!6 = !{i32 7, !"uwtable", i32 1}75!7 = !{!"clang"}76!8 = distinct !DISubprogram(name: "a", linkageName: "_Z1av", scope: !9, file: !9, line: 1, type: !10, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)77!9 = !DIFile(filename: "test.cpp", directory: "")78!10 = !DISubroutineType(types: !11)79!11 = !{null}80!12 = !{!13}81!13 = !DILocalVariable(scope: !8, file: !9, line: 1, type: !14)82!14 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !15, size: 64)83!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64)84!16 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)85!17 = !DILocation(line: 1, column: 16, scope: !18)86!18 = distinct !DILexicalBlock(scope: !8, file: !9, line: 1, column: 14)87!19 = !DILocation(line: 2, column: 1, scope: !18)88!20 = !DILocation(line: 1, column: 21, scope: !18)89!21 = !DILocation(line: 0, scope: !8)90!22 = !DILocation(line: 2, column: 1, scope: !23)91!23 = distinct !DILexicalBlock(scope: !8, file: !9, line: 1, column: 38)92!24 = !DILocation(line: 2, column: 1, scope: !8)93